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

Side by Side Diff: athena/content/app_activity_proxy.cc

Issue 548633005: Adding overview / layer framework to Activities so that unloaded / sleeping activities can be shown… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Created 6 years, 3 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
OLDNEW
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_proxy.h" 5 #include "athena/content/app_activity_proxy.h"
6 6
7 #include "athena/content/app_activity.h"
7 #include "athena/content/app_activity_registry.h" 8 #include "athena/content/app_activity_registry.h"
8 #include "athena/wm/public/window_list_provider.h" 9 #include "athena/wm/public/window_list_provider.h"
9 #include "athena/wm/public/window_manager.h" 10 #include "athena/wm/public/window_manager.h"
10 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
11 #include "ui/views/view.h" 12 #include "ui/views/view.h"
12 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
13 14
14 namespace athena { 15 namespace athena {
15 16
16 AppActivityProxy::AppActivityProxy(Activity* replaced_activity, 17 AppActivityProxy::AppActivityProxy(AppActivity* replaced_activity,
17 AppActivityRegistry* creator) : 18 AppActivityRegistry* creator) :
18 app_activity_registry_(creator), 19 app_activity_registry_(creator),
19 title_(replaced_activity->GetActivityViewModel()->GetTitle()), 20 title_(replaced_activity->GetActivityViewModel()->GetTitle()),
20 image_(replaced_activity->GetActivityViewModel()->GetOverviewModeImage()),
21 color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()), 21 color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()),
22 replaced_activity_(replaced_activity), 22 replaced_activity_(replaced_activity),
23 // TODO(skuhne): We probably need to do something better with the view
24 // (e.g. showing the passed image / layer).
25 view_(new views::View()) { 23 view_(new views::View()) {
26 } 24 }
27 25
28 AppActivityProxy::~AppActivityProxy() { 26 AppActivityProxy::~AppActivityProxy() {
29 app_activity_registry_->ProxyDestroyed(this); 27 app_activity_registry_->ProxyDestroyed(this);
30 } 28 }
31 29
32 ActivityViewModel* AppActivityProxy::GetActivityViewModel() { 30 ActivityViewModel* AppActivityProxy::GetActivityViewModel() {
33 return this; 31 return this;
34 } 32 }
(...skipping 22 matching lines...) Expand all
57 aura::Window* AppActivityProxy::GetWindow() { 55 aura::Window* AppActivityProxy::GetWindow() {
58 return view_->GetWidget()->GetNativeWindow(); 56 return view_->GetWidget()->GetNativeWindow();
59 } 57 }
60 58
61 void AppActivityProxy::Init() { 59 void AppActivityProxy::Init() {
62 DCHECK(replaced_activity_); 60 DCHECK(replaced_activity_);
63 WindowListProvider* window_list_provider = 61 WindowListProvider* window_list_provider =
64 WindowManager::GetInstance()->GetWindowListProvider(); 62 WindowManager::GetInstance()->GetWindowListProvider();
65 window_list_provider->StackWindowBehindTo(GetWindow(), 63 window_list_provider->StackWindowBehindTo(GetWindow(),
66 replaced_activity_->GetWindow()); 64 replaced_activity_->GetWindow());
67 // We moved. 65 // Get the content proxy to present the content.
66 content_proxy_ = replaced_activity_->GetContentProxy(GetWindow());
67 // After the Init() function returns, the passed |replaced_activity_| might
68 // get destroyed. Since we do not need it anymore we reset it.
68 replaced_activity_ = NULL; 69 replaced_activity_ = NULL;
69 } 70 }
70 71
71 SkColor AppActivityProxy::GetRepresentativeColor() const { 72 SkColor AppActivityProxy::GetRepresentativeColor() const {
72 return color_; 73 return color_;
73 } 74 }
74 75
75 base::string16 AppActivityProxy::GetTitle() const { 76 base::string16 AppActivityProxy::GetTitle() const {
76 return title_; 77 return title_;
77 } 78 }
78 79
79 bool AppActivityProxy::UsesFrame() const { 80 bool AppActivityProxy::UsesFrame() const {
80 return true; 81 return true;
81 } 82 }
82 83
83 views::View* AppActivityProxy::GetContentsView() { 84 views::View* AppActivityProxy::GetContentsView() {
84 return view_; 85 return view_;
85 } 86 }
86 87
87 void AppActivityProxy::CreateOverviewModeImage() {
88 // Nothing we can do here.
89 }
90
91 gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() { 88 gfx::ImageSkia AppActivityProxy::GetOverviewModeImage() {
92 return image_; 89 return content_proxy_->GetContentImage();
93 } 90 }
94 91
95 void AppActivityProxy::PrepareContentsForOverview() { 92 void AppActivityProxy::PrepareContentsForOverview() {
96 } 93 }
97 94
98 void AppActivityProxy::ResetContentsView() { 95 void AppActivityProxy::ResetContentsView() {
99 } 96 }
100 97
101 } // namespace athena 98 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698