diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-08-12 13:47:38 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-08-12 13:47:38 +0100 |
commit | 5f1c94371a64b3196d4be9466099bb892df9b88e (patch) | |
tree | 60a287ed27d1328d7806d12433d789b66ad91805 /apps/app_shim/extension_app_shim_handler_mac.cc | |
parent | 43165a58c6167882aabb62f470c4e4d21f807d79 (diff) | |
download | chromium_org-5f1c94371a64b3196d4be9466099bb892df9b88e.tar.gz |
Merge from Chromium at DEPS revision 288042
This commit was generated by merge_to_master.py.
Change-Id: I583602ff16d735199f1810565c9296e970ce2854
Diffstat (limited to 'apps/app_shim/extension_app_shim_handler_mac.cc')
-rw-r--r-- | apps/app_shim/extension_app_shim_handler_mac.cc | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc index 48f4eeeccd..cef6ca2d3a 100644 --- a/apps/app_shim/extension_app_shim_handler_mac.cc +++ b/apps/app_shim/extension_app_shim_handler_mac.cc @@ -227,9 +227,7 @@ AppShimHandler::Host* ExtensionAppShimHandler::FindHost( // static void ExtensionAppShimHandler::QuitAppForWindow(AppWindow* app_window) { - ExtensionAppShimHandler* handler = - g_browser_process->platform_part()->app_shim_host_manager()-> - extension_app_shim_handler(); + ExtensionAppShimHandler* handler = GetInstance(); Host* host = handler->FindHost( Profile::FromBrowserContext(app_window->browser_context()), app_window->extension_id()); @@ -244,9 +242,7 @@ void ExtensionAppShimHandler::QuitAppForWindow(AppWindow* app_window) { } void ExtensionAppShimHandler::HideAppForWindow(AppWindow* app_window) { - ExtensionAppShimHandler* handler = - g_browser_process->platform_part()->app_shim_host_manager()-> - extension_app_shim_handler(); + ExtensionAppShimHandler* handler = GetInstance(); Profile* profile = Profile::FromBrowserContext(app_window->browser_context()); Host* host = handler->FindHost(profile, app_window->extension_id()); if (host) @@ -256,9 +252,7 @@ void ExtensionAppShimHandler::HideAppForWindow(AppWindow* app_window) { } void ExtensionAppShimHandler::FocusAppForWindow(AppWindow* app_window) { - ExtensionAppShimHandler* handler = - g_browser_process->platform_part()->app_shim_host_manager()-> - extension_app_shim_handler(); + ExtensionAppShimHandler* handler = GetInstance(); Profile* profile = Profile::FromBrowserContext(app_window->browser_context()); const std::string& app_id = app_window->extension_id(); Host* host = handler->FindHost(profile, app_id); @@ -275,9 +269,7 @@ void ExtensionAppShimHandler::FocusAppForWindow(AppWindow* app_window) { // static bool ExtensionAppShimHandler::RequestUserAttentionForWindow( AppWindow* app_window) { - ExtensionAppShimHandler* handler = - g_browser_process->platform_part()->app_shim_host_manager()-> - extension_app_shim_handler(); + ExtensionAppShimHandler* handler = GetInstance(); Profile* profile = Profile::FromBrowserContext(app_window->browser_context()); Host* host = handler->FindHost(profile, app_window->extension_id()); if (host) { @@ -292,6 +284,19 @@ bool ExtensionAppShimHandler::RequestUserAttentionForWindow( } } +// static +void ExtensionAppShimHandler::OnChromeWillHide() { + // Send OnAppHide to all the shims so that they go into the hidden state. + // This is necessary so that when the shim is next focused, it will know to + // unhide. + ExtensionAppShimHandler* handler = GetInstance(); + for (HostMap::iterator it = handler->hosts_.begin(); + it != handler->hosts_.end(); + ++it) { + it->second->OnAppHide(); + } +} + void ExtensionAppShimHandler::OnShimLaunch( Host* host, AppShimLaunchType launch_type, @@ -331,6 +336,13 @@ void ExtensionAppShimHandler::OnShimLaunch( // Return now. OnAppLaunchComplete will be called when the app is activated. } +// static +ExtensionAppShimHandler* ExtensionAppShimHandler::GetInstance() { + return g_browser_process->platform_part() + ->app_shim_host_manager() + ->extension_app_shim_handler(); +} + void ExtensionAppShimHandler::OnProfileLoaded( Host* host, AppShimLaunchType launch_type, |