diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 21:39:29 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 21:39:29 +0000 |
commit | 8185255cc25f313327a22fdea124b98800f6105c (patch) | |
tree | 7f3bfae62cb378dc7f1ed7ee3a76d44598d34982 | |
parent | bc8babe6fd94bc6e76b15185d5a449df4e8802c6 (diff) | |
download | chromium_src-8185255cc25f313327a22fdea124b98800f6105c.zip chromium_src-8185255cc25f313327a22fdea124b98800f6105c.tar.gz chromium_src-8185255cc25f313327a22fdea124b98800f6105c.tar.bz2 |
Fix the blocked pluigin infobar for metro mode
Now relaunches wholesale chrome on desktop.
BUG=141032
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10928064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155490 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/lifetime/application_lifetime.cc | 12 | ||||
-rw-r--r-- | chrome/browser/lifetime/application_lifetime.h | 7 | ||||
-rw-r--r-- | chrome/browser/plugin_infobar_delegates.cc | 9 | ||||
-rw-r--r-- | chrome/browser/ui/browser_command_controller.cc | 16 |
4 files changed, 23 insertions, 21 deletions
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc index 0a88dac..5e2e63c 100644 --- a/chrome/browser/lifetime/application_lifetime.cc +++ b/chrome/browser/lifetime/application_lifetime.cc @@ -257,6 +257,18 @@ void AttemptRestart() { #endif } +#if defined(OS_WIN) +void AttemptRestartWithModeSwitch() { + // The kRestartSwitchMode preference does not exists for Windows 7 and older + // operating systems so there is no need for OS version check. + PrefService* prefs = g_browser_process->local_state(); + if (!prefs->HasPrefPath(prefs::kRestartSwitchMode)) + return; + prefs->SetBoolean(prefs::kRestartSwitchMode, true); + browser::AttemptRestart(); +} +#endif + void AttemptExit() { // If we know that all browsers can be closed without blocking, // don't notify users of crashes beyond this point. diff --git a/chrome/browser/lifetime/application_lifetime.h b/chrome/browser/lifetime/application_lifetime.h index f9d92ae..1f755b6 100644 --- a/chrome/browser/lifetime/application_lifetime.h +++ b/chrome/browser/lifetime/application_lifetime.h @@ -21,6 +21,13 @@ void AttemptUserExit(); // manager re-launch the browser with restore last session flag. void AttemptRestart(); +#if defined(OS_WIN) +// Windows 8 specific: Like AttemptRestart but if chrome is running +// in desktop mode it starts in metro mode and vice-versa. The switching like +// the restarting is controlled by a preference. +void AttemptRestartWithModeSwitch(); +#endif + // Attempt to exit by closing all browsers. This is equivalent to // CloseAllBrowsers() on platforms where the application exits // when no more windows are remaining. On other platforms (the Mac), diff --git a/chrome/browser/plugin_infobar_delegates.cc b/chrome/browser/plugin_infobar_delegates.cc index c55ca51..a8c04fc 100644 --- a/chrome/browser/plugin_infobar_delegates.cc +++ b/chrome/browser/plugin_infobar_delegates.cc @@ -8,6 +8,7 @@ #include "chrome/browser/api/infobars/infobar_service.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/google/google_util.h" +#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/plugin_observer.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/render_messages.h" @@ -455,7 +456,7 @@ int PluginMetroModeInfoBarDelegate::GetButtons() const { string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( InfoBarButton button) const { DCHECK_EQ(BUTTON_OK, button); - return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_TO_DESKTOP_BUTTON); + return l10n_util::GetStringUTF16(IDS_WIN8_DESKTOP_RESTART); } bool PluginMetroModeInfoBarDelegate::Accept() { @@ -466,11 +467,7 @@ bool PluginMetroModeInfoBarDelegate::Accept() { if (!web_contents->GetURL().is_valid()) return false; std::string url(web_contents->GetURL().spec()); - // This obscure use of the 'log usage' mask for windows 8 is documented - // here http://goo.gl/HBOe9. - ui::win::OpenAnyViaShell(UTF8ToUTF16(url), - string16(), - SEE_MASK_FLAG_LOG_USAGE); + browser::AttemptRestartWithModeSwitch(); return true; } diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index fdb6b50..6bd8d12 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -68,18 +68,6 @@ bool HasInternalURL(const NavigationEntry* entry) { return false; } -#if defined(OS_WIN) -void RestartWithModeSwitch() { - PrefService* prefs = g_browser_process->local_state(); - if (!prefs) - return; - if (!prefs->HasPrefPath(prefs::kRestartSwitchMode)) - return; - prefs->SetBoolean(prefs::kRestartSwitchMode, true); - browser::AttemptRestart(); -} -#endif - } // namespace namespace chrome { @@ -352,10 +340,8 @@ void BrowserCommandController::ExecuteCommandWithDisposition( browser_->SetMetroSnapMode(false); break; case IDC_WIN8_DESKTOP_RESTART: - RestartWithModeSwitch(); - break; case IDC_WIN8_METRO_RESTART: - RestartWithModeSwitch(); + browser::AttemptRestartWithModeSwitch(); break; #endif |