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

Side by Side Diff: trunk/src/apps/app_shim/extension_app_shim_handler_mac.cc

Issue 163913004: Revert 250826 "Remove Profile dependency from apps::ShellWindow" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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 | « trunk/src/apps/app_shim/app_shim_handler_mac.h ('k') | trunk/src/apps/app_window_contents.h » ('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 #include "apps/app_shim/extension_app_shim_handler_mac.h" 5 #include "apps/app_shim/extension_app_shim_handler_mac.h"
6 6
7 #include "apps/app_lifetime_monitor_factory.h" 7 #include "apps/app_lifetime_monitor_factory.h"
8 #include "apps/app_shim/app_shim_host_manager_mac.h" 8 #include "apps/app_shim/app_shim_host_manager_mac.h"
9 #include "apps/app_shim/app_shim_messages.h" 9 #include "apps/app_shim/app_shim_messages.h"
10 #include "apps/launcher.h" 10 #include "apps/launcher.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const std::string& app_id) { 223 const std::string& app_id) {
224 HostMap::iterator it = hosts_.find(make_pair(profile, app_id)); 224 HostMap::iterator it = hosts_.find(make_pair(profile, app_id));
225 return it == hosts_.end() ? NULL : it->second; 225 return it == hosts_.end() ? NULL : it->second;
226 } 226 }
227 227
228 // static 228 // static
229 void ExtensionAppShimHandler::QuitAppForWindow(ShellWindow* shell_window) { 229 void ExtensionAppShimHandler::QuitAppForWindow(ShellWindow* shell_window) {
230 ExtensionAppShimHandler* handler = 230 ExtensionAppShimHandler* handler =
231 g_browser_process->platform_part()->app_shim_host_manager()-> 231 g_browser_process->platform_part()->app_shim_host_manager()->
232 extension_app_shim_handler(); 232 extension_app_shim_handler();
233 Host* host = handler->FindHost( 233 Host* host = handler->FindHost(shell_window->profile(),
234 Profile::FromBrowserContext(shell_window->browser_context()), 234 shell_window->extension_id());
235 shell_window->extension_id());
236 if (host) { 235 if (host) {
237 handler->OnShimQuit(host); 236 handler->OnShimQuit(host);
238 } else { 237 } else {
239 // App shims might be disabled or the shim is still starting up. 238 // App shims might be disabled or the shim is still starting up.
240 ShellWindowRegistry::Get( 239 ShellWindowRegistry::Get(shell_window->profile())->
241 Profile::FromBrowserContext(shell_window->browser_context())) 240 CloseAllShellWindowsForApp(shell_window->extension_id());
242 ->CloseAllShellWindowsForApp(shell_window->extension_id());
243 } 241 }
244 } 242 }
245 243
246 void ExtensionAppShimHandler::HideAppForWindow(ShellWindow* shell_window) { 244 void ExtensionAppShimHandler::HideAppForWindow(ShellWindow* shell_window) {
247 ExtensionAppShimHandler* handler = 245 ExtensionAppShimHandler* handler =
248 g_browser_process->platform_part()->app_shim_host_manager()-> 246 g_browser_process->platform_part()->app_shim_host_manager()->
249 extension_app_shim_handler(); 247 extension_app_shim_handler();
250 Profile* profile = 248 Profile* profile = shell_window->profile();
251 Profile::FromBrowserContext(shell_window->browser_context());
252 Host* host = handler->FindHost(profile, shell_window->extension_id()); 249 Host* host = handler->FindHost(profile, shell_window->extension_id());
253 if (host) 250 if (host)
254 host->OnAppHide(); 251 host->OnAppHide();
255 else 252 else
256 SetAppHidden(profile, shell_window->extension_id(), true); 253 SetAppHidden(profile, shell_window->extension_id(), true);
257 } 254 }
258 255
259 256
260 void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) { 257 void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) {
261 ExtensionAppShimHandler* handler = 258 ExtensionAppShimHandler* handler =
262 g_browser_process->platform_part()->app_shim_host_manager()-> 259 g_browser_process->platform_part()->app_shim_host_manager()->
263 extension_app_shim_handler(); 260 extension_app_shim_handler();
264 Profile* profile = 261 Profile* profile = shell_window->profile();
265 Profile::FromBrowserContext(shell_window->browser_context());
266 const std::string& app_id = shell_window->extension_id(); 262 const std::string& app_id = shell_window->extension_id();
267 Host* host = handler->FindHost(profile, app_id); 263 Host* host = handler->FindHost(profile, app_id);
268 if (host) { 264 if (host) {
269 handler->OnShimFocus(host, 265 handler->OnShimFocus(host,
270 APP_SHIM_FOCUS_NORMAL, 266 APP_SHIM_FOCUS_NORMAL,
271 std::vector<base::FilePath>()); 267 std::vector<base::FilePath>());
272 } else { 268 } else {
273 FocusWindows( 269 FocusWindows(
274 apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id)); 270 apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id));
275 } 271 }
276 } 272 }
277 273
278 // static 274 // static
279 bool ExtensionAppShimHandler::RequestUserAttentionForWindow( 275 bool ExtensionAppShimHandler::RequestUserAttentionForWindow(
280 ShellWindow* shell_window) { 276 ShellWindow* shell_window) {
281 ExtensionAppShimHandler* handler = 277 ExtensionAppShimHandler* handler =
282 g_browser_process->platform_part()->app_shim_host_manager()-> 278 g_browser_process->platform_part()->app_shim_host_manager()->
283 extension_app_shim_handler(); 279 extension_app_shim_handler();
284 Profile* profile = 280 Profile* profile = shell_window->profile();
285 Profile::FromBrowserContext(shell_window->browser_context());
286 Host* host = handler->FindHost(profile, shell_window->extension_id()); 281 Host* host = handler->FindHost(profile, shell_window->extension_id());
287 if (host) { 282 if (host) {
288 // Bring the window to the front without showing it. 283 // Bring the window to the front without showing it.
289 ShellWindowRegistry::Get(profile)->ShellWindowActivated(shell_window); 284 ShellWindowRegistry::Get(profile)->ShellWindowActivated(shell_window);
290 host->OnAppRequestUserAttention(); 285 host->OnAppRequestUserAttention();
291 return true; 286 return true;
292 } else { 287 } else {
293 // Just show the app. 288 // Just show the app.
294 SetAppHidden(profile, shell_window->extension_id(), false); 289 SetAppHidden(profile, shell_window->extension_id(), false);
295 return false; 290 return false;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if (hosts_.empty()) 522 if (hosts_.empty())
528 delegate_->MaybeTerminate(); 523 delegate_->MaybeTerminate();
529 } 524 }
530 525
531 void ExtensionAppShimHandler::OnAppStop(Profile* profile, 526 void ExtensionAppShimHandler::OnAppStop(Profile* profile,
532 const std::string& app_id) {} 527 const std::string& app_id) {}
533 528
534 void ExtensionAppShimHandler::OnChromeTerminating() {} 529 void ExtensionAppShimHandler::OnChromeTerminating() {}
535 530
536 } // namespace apps 531 } // namespace apps
OLDNEW
« no previous file with comments | « trunk/src/apps/app_shim/app_shim_handler_mac.h ('k') | trunk/src/apps/app_window_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698