Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/app_window.h" | 10 #include "apps/app_window.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 AppWindowRegistry::Get(profile)->AppWindowActivated(app_window); | 285 AppWindowRegistry::Get(profile)->AppWindowActivated(app_window); |
| 286 host->OnAppRequestUserAttention(); | 286 host->OnAppRequestUserAttention(); |
| 287 return true; | 287 return true; |
| 288 } else { | 288 } else { |
| 289 // Just show the app. | 289 // Just show the app. |
| 290 SetAppHidden(profile, app_window->extension_id(), false); | 290 SetAppHidden(profile, app_window->extension_id(), false); |
| 291 return false; | 291 return false; |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 // static | |
| 296 void ExtensionAppShimHandler::OnChromeWillHide() { | |
| 297 // Send OnAppHide to all the shims so that they go into the hidden state. | |
| 298 // This is necessary so that when the shim is next focused, it will know to | |
| 299 // unhide. | |
| 300 ExtensionAppShimHandler* handler = g_browser_process->platform_part() | |
|
tapted
2014/07/18 06:24:34
nit: WDYT about adding a GetHandler/GetInstance()
jackhou1
2014/07/21 01:11:27
Done.
| |
| 301 ->app_shim_host_manager() | |
| 302 ->extension_app_shim_handler(); | |
| 303 for (HostMap::iterator it = handler->hosts_.begin(); | |
| 304 it != handler->hosts_.end(); | |
| 305 ++it) { | |
| 306 it->second->OnAppHide(); | |
| 307 } | |
| 308 } | |
| 309 | |
| 295 void ExtensionAppShimHandler::OnShimLaunch( | 310 void ExtensionAppShimHandler::OnShimLaunch( |
| 296 Host* host, | 311 Host* host, |
| 297 AppShimLaunchType launch_type, | 312 AppShimLaunchType launch_type, |
| 298 const std::vector<base::FilePath>& files) { | 313 const std::vector<base::FilePath>& files) { |
| 299 const std::string& app_id = host->GetAppId(); | 314 const std::string& app_id = host->GetAppId(); |
| 300 DCHECK(extensions::Extension::IdIsValid(app_id)); | 315 DCHECK(extensions::Extension::IdIsValid(app_id)); |
| 301 | 316 |
| 302 const base::FilePath& profile_path = host->GetProfilePath(); | 317 const base::FilePath& profile_path = host->GetProfilePath(); |
| 303 DCHECK(!profile_path.empty()); | 318 DCHECK(!profile_path.empty()); |
| 304 | 319 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 if (hosts_.empty()) | 538 if (hosts_.empty()) |
| 524 delegate_->MaybeTerminate(); | 539 delegate_->MaybeTerminate(); |
| 525 } | 540 } |
| 526 | 541 |
| 527 void ExtensionAppShimHandler::OnAppStop(Profile* profile, | 542 void ExtensionAppShimHandler::OnAppStop(Profile* profile, |
| 528 const std::string& app_id) {} | 543 const std::string& app_id) {} |
| 529 | 544 |
| 530 void ExtensionAppShimHandler::OnChromeTerminating() {} | 545 void ExtensionAppShimHandler::OnChromeTerminating() {} |
| 531 | 546 |
| 532 } // namespace apps | 547 } // namespace apps |
| OLD | NEW |