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

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

Issue 164613002: Revert 251094 "Revert 250826 "Remove Profile dependency from app..." (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(shell_window->profile(), 233 Host* host = handler->FindHost(
234 shell_window->extension_id()); 234 Profile::FromBrowserContext(shell_window->browser_context()),
235 shell_window->extension_id());
235 if (host) { 236 if (host) {
236 handler->OnShimQuit(host); 237 handler->OnShimQuit(host);
237 } else { 238 } else {
238 // App shims might be disabled or the shim is still starting up. 239 // App shims might be disabled or the shim is still starting up.
239 ShellWindowRegistry::Get(shell_window->profile())-> 240 ShellWindowRegistry::Get(
240 CloseAllShellWindowsForApp(shell_window->extension_id()); 241 Profile::FromBrowserContext(shell_window->browser_context()))
242 ->CloseAllShellWindowsForApp(shell_window->extension_id());
241 } 243 }
242 } 244 }
243 245
244 void ExtensionAppShimHandler::HideAppForWindow(ShellWindow* shell_window) { 246 void ExtensionAppShimHandler::HideAppForWindow(ShellWindow* shell_window) {
245 ExtensionAppShimHandler* handler = 247 ExtensionAppShimHandler* handler =
246 g_browser_process->platform_part()->app_shim_host_manager()-> 248 g_browser_process->platform_part()->app_shim_host_manager()->
247 extension_app_shim_handler(); 249 extension_app_shim_handler();
248 Profile* profile = shell_window->profile(); 250 Profile* profile =
251 Profile::FromBrowserContext(shell_window->browser_context());
249 Host* host = handler->FindHost(profile, shell_window->extension_id()); 252 Host* host = handler->FindHost(profile, shell_window->extension_id());
250 if (host) 253 if (host)
251 host->OnAppHide(); 254 host->OnAppHide();
252 else 255 else
253 SetAppHidden(profile, shell_window->extension_id(), true); 256 SetAppHidden(profile, shell_window->extension_id(), true);
254 } 257 }
255 258
256 259
257 void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) { 260 void ExtensionAppShimHandler::FocusAppForWindow(ShellWindow* shell_window) {
258 ExtensionAppShimHandler* handler = 261 ExtensionAppShimHandler* handler =
259 g_browser_process->platform_part()->app_shim_host_manager()-> 262 g_browser_process->platform_part()->app_shim_host_manager()->
260 extension_app_shim_handler(); 263 extension_app_shim_handler();
261 Profile* profile = shell_window->profile(); 264 Profile* profile =
265 Profile::FromBrowserContext(shell_window->browser_context());
262 const std::string& app_id = shell_window->extension_id(); 266 const std::string& app_id = shell_window->extension_id();
263 Host* host = handler->FindHost(profile, app_id); 267 Host* host = handler->FindHost(profile, app_id);
264 if (host) { 268 if (host) {
265 handler->OnShimFocus(host, 269 handler->OnShimFocus(host,
266 APP_SHIM_FOCUS_NORMAL, 270 APP_SHIM_FOCUS_NORMAL,
267 std::vector<base::FilePath>()); 271 std::vector<base::FilePath>());
268 } else { 272 } else {
269 FocusWindows( 273 FocusWindows(
270 apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id)); 274 apps::ShellWindowRegistry::Get(profile)->GetShellWindowsForApp(app_id));
271 } 275 }
272 } 276 }
273 277
274 // static 278 // static
275 bool ExtensionAppShimHandler::RequestUserAttentionForWindow( 279 bool ExtensionAppShimHandler::RequestUserAttentionForWindow(
276 ShellWindow* shell_window) { 280 ShellWindow* shell_window) {
277 ExtensionAppShimHandler* handler = 281 ExtensionAppShimHandler* handler =
278 g_browser_process->platform_part()->app_shim_host_manager()-> 282 g_browser_process->platform_part()->app_shim_host_manager()->
279 extension_app_shim_handler(); 283 extension_app_shim_handler();
280 Profile* profile = shell_window->profile(); 284 Profile* profile =
285 Profile::FromBrowserContext(shell_window->browser_context());
281 Host* host = handler->FindHost(profile, shell_window->extension_id()); 286 Host* host = handler->FindHost(profile, shell_window->extension_id());
282 if (host) { 287 if (host) {
283 // Bring the window to the front without showing it. 288 // Bring the window to the front without showing it.
284 ShellWindowRegistry::Get(profile)->ShellWindowActivated(shell_window); 289 ShellWindowRegistry::Get(profile)->ShellWindowActivated(shell_window);
285 host->OnAppRequestUserAttention(); 290 host->OnAppRequestUserAttention();
286 return true; 291 return true;
287 } else { 292 } else {
288 // Just show the app. 293 // Just show the app.
289 SetAppHidden(profile, shell_window->extension_id(), false); 294 SetAppHidden(profile, shell_window->extension_id(), false);
290 return false; 295 return false;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (hosts_.empty()) 527 if (hosts_.empty())
523 delegate_->MaybeTerminate(); 528 delegate_->MaybeTerminate();
524 } 529 }
525 530
526 void ExtensionAppShimHandler::OnAppStop(Profile* profile, 531 void ExtensionAppShimHandler::OnAppStop(Profile* profile,
527 const std::string& app_id) {} 532 const std::string& app_id) {}
528 533
529 void ExtensionAppShimHandler::OnChromeTerminating() {} 534 void ExtensionAppShimHandler::OnChromeTerminating() {}
530 535
531 } // namespace apps 536 } // 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