| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/content/app_activity_registry.h" | 5 #include "athena/content/app_activity_registry.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_manager.h" | 7 #include "athena/activity/public/activity_manager.h" |
| 8 #include "athena/content/app_activity.h" | 8 #include "athena/content/app_activity.h" |
| 9 #include "athena/content/app_activity_proxy.h" | 9 #include "athena/content/app_activity_proxy.h" |
| 10 #include "athena/content/public/app_registry.h" | 10 #include "athena/content/public/app_registry.h" |
| 11 #include "athena/extensions/public/extensions_delegate.h" | 11 #include "athena/extensions/public/extensions_delegate.h" |
| 12 #include "athena/resource_manager/public/resource_manager.h" | 12 #include "athena/resource_manager/public/resource_manager.h" |
| 13 #include "athena/wm/public/window_list_provider.h" |
| 14 #include "athena/wm/public/window_manager.h" |
| 13 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 14 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 15 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 16 | 18 |
| 17 namespace athena { | 19 namespace athena { |
| 18 | 20 |
| 19 AppActivityRegistry::AppActivityRegistry( | 21 AppActivityRegistry::AppActivityRegistry( |
| 20 const std::string& app_id, | 22 const std::string& app_id, |
| 21 content::BrowserContext* browser_context) : | 23 content::BrowserContext* browser_context) : |
| 22 app_id_(app_id), | 24 app_id_(app_id), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void AppActivityRegistry::RestartApplication(AppActivityProxy* proxy) { | 98 void AppActivityRegistry::RestartApplication(AppActivityProxy* proxy) { |
| 97 DCHECK_EQ(unloaded_activity_proxy_, proxy); | 99 DCHECK_EQ(unloaded_activity_proxy_, proxy); |
| 98 // Restart the application. Note that the first created app window will make | 100 // Restart the application. Note that the first created app window will make |
| 99 // sure that the proxy gets deleted - after - the new activity got moved | 101 // sure that the proxy gets deleted - after - the new activity got moved |
| 100 // to the proxies activity location. | 102 // to the proxies activity location. |
| 101 ExtensionsDelegate::Get(browser_context_)->LaunchApp(app_id_); | 103 ExtensionsDelegate::Get(browser_context_)->LaunchApp(app_id_); |
| 102 } | 104 } |
| 103 | 105 |
| 104 AppActivity* AppActivityRegistry::GetMruActivity() { | 106 AppActivity* AppActivityRegistry::GetMruActivity() { |
| 105 DCHECK(activity_list_.size()); | 107 DCHECK(activity_list_.size()); |
| 106 // TODO(skuhne): This should be a query into the window manager. | 108 WindowListProvider* window_list_provider = |
| 109 WindowManager::GetInstance()->GetWindowListProvider(); |
| 107 const aura::Window::Windows children = | 110 const aura::Window::Windows children = |
| 108 activity_list_[0]->GetWindow()->parent()->children(); | 111 window_list_provider->GetCurrentWindowList(); |
| 109 // Find the first window in the container which is part of the application. | 112 // Find the first window in the container which is part of the application. |
| 110 for (aura::Window::Windows::const_iterator child_iterator = children.begin(); | 113 for (aura::Window::Windows::const_iterator child_iterator = children.begin(); |
| 111 child_iterator != children.end(); ++child_iterator) { | 114 child_iterator != children.end(); ++child_iterator) { |
| 112 for (std::vector<AppActivity*>::iterator app_iterator = | 115 for (std::vector<AppActivity*>::iterator app_iterator = |
| 113 activity_list_.begin(); | 116 activity_list_.begin(); |
| 114 app_iterator != activity_list_.end(); ++app_iterator) { | 117 app_iterator != activity_list_.end(); ++app_iterator) { |
| 115 if (*child_iterator == (*app_iterator)->GetWindow()) | 118 if (*child_iterator == (*app_iterator)->GetWindow()) |
| 116 return *app_iterator; | 119 return *app_iterator; |
| 117 } | 120 } |
| 118 } | 121 } |
| 119 NOTREACHED() << "The application does not get tracked by the mru list"; | 122 NOTREACHED() << "The application does not get tracked by the mru list"; |
| 120 return NULL; | 123 return NULL; |
| 121 } | 124 } |
| 122 | 125 |
| 123 } // namespace athena | 126 } // namespace athena |
| OLD | NEW |