diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 23:22:14 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 23:22:14 +0000 |
commit | 0e875ac95811609c7c7b0220bcd3cef9a4e990f7 (patch) | |
tree | 4bf87d17d2e6dda4f6301bd6046821a361c76d60 /chrome | |
parent | ba03c8c05b52aa7e48a8235a9c26c765cbf5cf9e (diff) | |
download | chromium_src-0e875ac95811609c7c7b0220bcd3cef9a4e990f7.zip chromium_src-0e875ac95811609c7c7b0220bcd3cef9a4e990f7.tar.gz chromium_src-0e875ac95811609c7c7b0220bcd3cef9a4e990f7.tar.bz2 |
Open a browser tab when Ash on Windows is launched.
The current behavior is to launch ash with nothing open
so the user would need to click on the Chrome ash icon
to see the browser.
This change creates two new notification types which
we use to show the Ash browser window. It is done this
way to preserve symmetry with
chrome_shell_delegate_chromeos.cc
BUG=227247
TEST=open ash a window should be shown.
Review URL: https://chromiumcodereview.appspot.com/15021003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/metro_viewer/metro_viewer_process_host_win.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_views.cc | 23 | ||||
-rw-r--r-- | chrome/common/chrome_notification_types.h | 8 |
3 files changed, 42 insertions, 2 deletions
diff --git a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc index 806d29c..caf5984 100644 --- a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc +++ b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc @@ -12,7 +12,9 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/host_desktop.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/common/chrome_notification_types.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" #include "ipc/ipc_channel_proxy.h" #include "ui/aura/remote_root_window_host_win.h" @@ -77,6 +79,12 @@ void MetroViewerProcessHost::OnChannelError() { g_browser_process->ReleaseModule(); CloseOpenAshBrowsers(); chrome::CloseAsh(); + // Tell the rest of Chrome about it. + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_ASH_SESSION_ENDED, + content::NotificationService::AllSources(), + content::NotificationService::NoDetails()); + // This will delete the MetroViewerProcessHost object. Don't access member // variables/functions after this call. g_browser_process->OnMetroViewerProcessTerminated(); @@ -91,4 +99,9 @@ void MetroViewerProcessHost::OnSetTargetSurface( AcceleratedPresenter::GetForWindow(NULL); any_window->SetNewTargetWindow(hwnd); aura::RemoteRootWindowHostWin::Instance()->Connected(this); + // Tell the rest of Chrome that Ash is running. + content::NotificationService::current()->Notify( + chrome::NOTIFICATION_ASH_SESSION_STARTED, + content::NotificationService::AllSources(), + content::NotificationService::NoDetails()); } diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index 139c9e6..ebb5d50 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc @@ -7,6 +7,10 @@ #include "ash/magnifier/magnifier_constants.h" #include "chrome/browser/ui/ash/caps_lock_delegate_views.h" #include "chrome/browser/ui/ash/window_positioner.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" +#include "content/public/browser/notification_service.h" bool ChromeShellDelegate::IsFirstRunAfterBoot() const { return false; @@ -97,9 +101,24 @@ void ChromeShellDelegate::HandleMediaPrevTrack() { void ChromeShellDelegate::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - // MSVC++ warns about switch statements without any cases. - NOTREACHED() << "Unexpected notification " << type; + switch (type) { + case chrome::NOTIFICATION_ASH_SESSION_STARTED: + GetTargetBrowser()->window()->Show(); + break; + case chrome::NOTIFICATION_ASH_SESSION_ENDED: + break; + default: + NOTREACHED() << "Unexpected notification " << type; + } } void ChromeShellDelegate::PlatformInit() { +#if defined(OS_WIN) + registrar_.Add(this, + chrome::NOTIFICATION_ASH_SESSION_STARTED, + content::NotificationService::AllSources()); + registrar_.Add(this, + chrome::NOTIFICATION_ASH_SESSION_ENDED, + content::NotificationService::AllSources()); +#endif } diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h index 6c5c11f..84dc9a9 100644 --- a/chrome/common/chrome_notification_types.h +++ b/chrome/common/chrome_notification_types.h @@ -1130,6 +1130,14 @@ enum NotificationType { #if defined(USE_ASH) // Sent when wallpaper show animation has finished. NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, + + // Sent when the Ash session has started. In its current incantation this is + // generated when the metro app has connected to the browser IPC channel. + // Used only on Windows. + NOTIFICATION_ASH_SESSION_STARTED, + // Sent when the Ash session ended. Currently this means the metro app exited. + // Used only on Windows. + NOTIFICATION_ASH_SESSION_ENDED, #endif #if defined(OS_CHROMEOS) |