Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3170)

Unified Diff: apps/app_shim/extension_app_shim_handler_mac.cc

Issue 403743002: [Mac] Hide all shims when Chrome is hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_shim/extension_app_shim_handler_mac.h ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_shim/extension_app_shim_handler_mac.cc
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 48f4eeeccd7dd27ce7b4de5eaa8795f6ddd31909..cef6ca2d3a6c4fdf1c312c177df502224b92aefc 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,
« no previous file with comments | « apps/app_shim/extension_app_shim_handler_mac.h ('k') | chrome/browser/app_controller_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698