| 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->MoveWindowInFrontOfReferenceWindow( |
| 97 app_proxy->GetWindow(), |
| 98 GetWindow()); |
| 95 Activity::Delete(app_proxy); | 99 Activity::Delete(app_proxy); |
| 96 // With the removal the object, the proxy should be deleted. | 100 // With the removal the object, the proxy should be deleted. |
| 97 DCHECK(!app_activity_registry_->unloaded_activity_proxy()); | 101 DCHECK(!app_activity_registry_->unloaded_activity_proxy()); |
| 98 } | 102 } |
| 99 } | 103 } |
| 100 | 104 |
| 101 SkColor AppActivity::GetRepresentativeColor() const { | 105 SkColor AppActivity::GetRepresentativeColor() const { |
| 102 // TODO(sad): Compute the color from the favicon. | 106 // TODO(sad): Compute the color from the favicon. |
| 103 return SK_ColorGRAY; | 107 return SK_ColorGRAY; |
| 104 } | 108 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 overview_mode_image_ = gfx::ImageSkia(); | 202 overview_mode_image_ = gfx::ImageSkia(); |
| 199 } | 203 } |
| 200 // Now we can hide this. | 204 // Now we can hide this. |
| 201 // Note: This might have to be done asynchronously after the readback took | 205 // Note: This might have to be done asynchronously after the readback took |
| 202 // place. | 206 // place. |
| 203 web_view_->SetVisible(false); | 207 web_view_->SetVisible(false); |
| 204 web_view_->GetWebContents()->GetNativeView()->Hide(); | 208 web_view_->GetWebContents()->GetNativeView()->Hide(); |
| 205 } | 209 } |
| 206 | 210 |
| 207 } // namespace athena | 211 } // namespace athena |
| OLD | NEW |