| 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.h" | 5 #include "athena/content/app_activity.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_registry.h" | 8 #include "athena/content/app_activity_registry.h" |
| 9 #include "athena/content/public/app_registry.h" | 9 #include "athena/content/public/app_registry.h" |
| 10 #include "athena/wm/public/window_list_provider.h" |
| 11 #include "athena/wm/public/window_manager.h" |
| 10 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 11 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 12 #include "ui/views/controls/webview/webview.h" | 14 #include "ui/views/controls/webview/webview.h" |
| 13 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 14 | 16 |
| 15 namespace athena { | 17 namespace athena { |
| 16 | 18 |
| 17 // TODO(mukai): specifies the same accelerators of WebActivity. | 19 // TODO(mukai): specifies the same accelerators of WebActivity. |
| 18 AppActivity::AppActivity(const std::string& app_id) | 20 AppActivity::AppActivity(const std::string& app_id) |
| 19 : app_id_(app_id), | 21 : app_id_(app_id), |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 82 } |
| 81 | 83 |
| 82 aura::Window* AppActivity::GetWindow() { | 84 aura::Window* AppActivity::GetWindow() { |
| 83 return !web_view_ ? NULL : web_view_->GetWidget()->GetNativeWindow(); | 85 return !web_view_ ? NULL : web_view_->GetWidget()->GetNativeWindow(); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void AppActivity::Init() { | 88 void AppActivity::Init() { |
| 87 DCHECK(app_activity_registry_); | 89 DCHECK(app_activity_registry_); |
| 88 Activity* app_proxy = app_activity_registry_->unloaded_activity_proxy(); | 90 Activity* app_proxy = app_activity_registry_->unloaded_activity_proxy(); |
| 89 if (app_proxy) { | 91 if (app_proxy) { |
| 90 // TODO(skuhne): This should call the WindowListProvider to re-arrange. | |
| 91 // Note: At this time the |AppActivity| did not get registered to the | 92 // Note: At this time the |AppActivity| did not get registered to the |
| 92 // |ResourceManager| - so we can move it around if needed. | 93 // |ResourceManager| - so we can move it around if needed. |
| 93 aura::Window* proxy_window = app_proxy->GetWindow(); | 94 WindowListProvider* window_list_provider = |
| 94 proxy_window->parent()->StackChildBelow(GetWindow(), proxy_window); | 95 WindowManager::GetInstance()->GetWindowListProvider(); |
| 96 window_list_provider->StackWindowFrontOf(app_proxy->GetWindow(), |
| 97 GetWindow()); |
| 95 Activity::Delete(app_proxy); | 98 Activity::Delete(app_proxy); |
| 96 // With the removal the object, the proxy should be deleted. | 99 // With the removal the object, the proxy should be deleted. |
| 97 DCHECK(!app_activity_registry_->unloaded_activity_proxy()); | 100 DCHECK(!app_activity_registry_->unloaded_activity_proxy()); |
| 98 } | 101 } |
| 99 } | 102 } |
| 100 | 103 |
| 101 SkColor AppActivity::GetRepresentativeColor() const { | 104 SkColor AppActivity::GetRepresentativeColor() const { |
| 102 // TODO(sad): Compute the color from the favicon. | 105 // TODO(sad): Compute the color from the favicon. |
| 103 return SK_ColorGRAY; | 106 return SK_ColorGRAY; |
| 104 } | 107 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 overview_mode_image_ = gfx::ImageSkia(); | 212 overview_mode_image_ = gfx::ImageSkia(); |
| 210 } | 213 } |
| 211 // Now we can hide this. | 214 // Now we can hide this. |
| 212 // Note: This might have to be done asynchronously after the readback took | 215 // Note: This might have to be done asynchronously after the readback took |
| 213 // place. | 216 // place. |
| 214 web_view_->SetVisible(false); | 217 web_view_->SetVisible(false); |
| 215 web_view_->GetWebContents()->GetNativeView()->Hide(); | 218 web_view_->GetWebContents()->GetNativeView()->Hide(); |
| 216 } | 219 } |
| 217 | 220 |
| 218 } // namespace athena | 221 } // namespace athena |
| OLD | NEW |