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

Side by Side Diff: apps/app_shim/extension_app_shim_handler_mac.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | apps/app_shim/extension_app_shim_handler_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ 5 #ifndef APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_
6 #define APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ 6 #define APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static void QuitAppForWindow(AppWindow* app_window); 76 static void QuitAppForWindow(AppWindow* app_window);
77 77
78 static void HideAppForWindow(AppWindow* app_window); 78 static void HideAppForWindow(AppWindow* app_window);
79 79
80 static void FocusAppForWindow(AppWindow* app_window); 80 static void FocusAppForWindow(AppWindow* app_window);
81 81
82 // Brings the window to the front without showing it and instructs the shim to 82 // Brings the window to the front without showing it and instructs the shim to
83 // request user attention. Returns false if there is no shim for this window. 83 // request user attention. Returns false if there is no shim for this window.
84 static bool RequestUserAttentionForWindow(AppWindow* app_window); 84 static bool RequestUserAttentionForWindow(AppWindow* app_window);
85 85
86 // Called by AppControllerMac when Chrome hides.
87 static void OnChromeWillHide();
88
86 // AppShimHandler overrides: 89 // AppShimHandler overrides:
87 virtual void OnShimLaunch(Host* host, 90 virtual void OnShimLaunch(Host* host,
88 AppShimLaunchType launch_type, 91 AppShimLaunchType launch_type,
89 const std::vector<base::FilePath>& files) OVERRIDE; 92 const std::vector<base::FilePath>& files) OVERRIDE;
90 virtual void OnShimClose(Host* host) OVERRIDE; 93 virtual void OnShimClose(Host* host) OVERRIDE;
91 virtual void OnShimFocus(Host* host, 94 virtual void OnShimFocus(Host* host,
92 AppShimFocusType focus_type, 95 AppShimFocusType focus_type,
93 const std::vector<base::FilePath>& files) OVERRIDE; 96 const std::vector<base::FilePath>& files) OVERRIDE;
94 virtual void OnShimSetHidden(Host* host, bool hidden) OVERRIDE; 97 virtual void OnShimSetHidden(Host* host, bool hidden) OVERRIDE;
95 virtual void OnShimQuit(Host* host) OVERRIDE; 98 virtual void OnShimQuit(Host* host) OVERRIDE;
(...skipping 15 matching lines...) Expand all
111 protected: 114 protected:
112 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*> 115 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*>
113 HostMap; 116 HostMap;
114 117
115 // Exposed for testing. 118 // Exposed for testing.
116 void set_delegate(Delegate* delegate); 119 void set_delegate(Delegate* delegate);
117 HostMap& hosts() { return hosts_; } 120 HostMap& hosts() { return hosts_; }
118 content::NotificationRegistrar& registrar() { return registrar_; } 121 content::NotificationRegistrar& registrar() { return registrar_; }
119 122
120 private: 123 private:
124 // Helper function to get the instance on the browser process.
125 static ExtensionAppShimHandler* GetInstance();
126
121 // This is passed to Delegate::LoadProfileAsync for shim-initiated launches 127 // This is passed to Delegate::LoadProfileAsync for shim-initiated launches
122 // where the profile was not yet loaded. 128 // where the profile was not yet loaded.
123 void OnProfileLoaded(Host* host, 129 void OnProfileLoaded(Host* host,
124 AppShimLaunchType launch_type, 130 AppShimLaunchType launch_type,
125 const std::vector<base::FilePath>& files, 131 const std::vector<base::FilePath>& files,
126 Profile* profile); 132 Profile* profile);
127 133
128 // This is passed to Delegate::EnableViaPrompt for shim-initiated launches 134 // This is passed to Delegate::EnableViaPrompt for shim-initiated launches
129 // where the extension is disabled. 135 // where the extension is disabled.
130 void OnExtensionEnabled(const base::FilePath& profile_path, 136 void OnExtensionEnabled(const base::FilePath& profile_path,
131 const std::string& app_id, 137 const std::string& app_id,
132 const std::vector<base::FilePath>& files); 138 const std::vector<base::FilePath>& files);
133 139
134 scoped_ptr<Delegate> delegate_; 140 scoped_ptr<Delegate> delegate_;
135 141
136 HostMap hosts_; 142 HostMap hosts_;
137 143
138 content::NotificationRegistrar registrar_; 144 content::NotificationRegistrar registrar_;
139 145
140 base::WeakPtrFactory<ExtensionAppShimHandler> weak_factory_; 146 base::WeakPtrFactory<ExtensionAppShimHandler> weak_factory_;
141 147
142 DISALLOW_COPY_AND_ASSIGN(ExtensionAppShimHandler); 148 DISALLOW_COPY_AND_ASSIGN(ExtensionAppShimHandler);
143 }; 149 };
144 150
145 } // namespace apps 151 } // namespace apps
146 152
147 #endif // APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ 153 #endif // APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | apps/app_shim/extension_app_shim_handler_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698