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

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

Issue 591693002: Creating PNG images from web content to be used by OverviewMode navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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.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/content_proxy.h" 9 #include "athena/content/content_proxy.h"
10 #include "athena/content/public/app_registry.h" 10 #include "athena/content/public/app_registry.h"
11 #include "athena/wm/public/window_list_provider.h" 11 #include "athena/wm/public/window_list_provider.h"
12 #include "athena/wm/public/window_manager.h" 12 #include "athena/wm/public/window_manager.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
15 #include "ui/views/controls/webview/webview.h" 15 #include "ui/views/controls/webview/webview.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 namespace athena { 18 namespace athena {
19 19
20 // TODO(mukai): specifies the same accelerators of WebActivity. 20 // TODO(mukai): specifies the same accelerators of WebActivity.
21 AppActivity::AppActivity(const std::string& app_id) 21 AppActivity::AppActivity(const std::string& app_id)
22 : app_id_(app_id), 22 : app_id_(app_id),
23 web_view_(NULL), 23 web_view_(NULL),
24 current_state_(ACTIVITY_UNLOADED), 24 current_state_(ACTIVITY_UNLOADED),
25 app_activity_registry_(NULL) { 25 app_activity_registry_(NULL) {
26 } 26 }
27 27
28 scoped_ptr<ContentProxy> AppActivity::GetContentProxy(aura::Window* window) { 28 scoped_ptr<ContentProxy> AppActivity::GetContentProxy() {
29 if (content_proxy_.get()) 29 if (content_proxy_.get())
30 content_proxy_->Reparent(window); 30 content_proxy_->ContentGetsDestroyed();
oshima 2014/09/22 16:10:28 At this point, is AppAcitivyt's content supposed t
Mr4D (OOO till 08-26) 2014/09/23 19:07:33 No, not yet. This object will be destroyed because
31 return content_proxy_.Pass(); 31 return content_proxy_.Pass();
32 } 32 }
33 33
34 ActivityViewModel* AppActivity::GetActivityViewModel() { 34 ActivityViewModel* AppActivity::GetActivityViewModel() {
35 return this; 35 return this;
36 } 36 }
37 37
38 void AppActivity::SetCurrentState(Activity::ActivityState state) { 38 void AppActivity::SetCurrentState(Activity::ActivityState state) {
39 DCHECK_NE(state, current_state_); 39 DCHECK_NE(state, current_state_);
40 ActivityState current_state = current_state_; 40 ActivityState current_state = current_state_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ShowContentProxy(); 135 ShowContentProxy();
136 } else { 136 } else {
137 // If not previously specified, we change the state now to invisible.. 137 // If not previously specified, we change the state now to invisible..
138 SetCurrentState(ACTIVITY_INVISIBLE); 138 SetCurrentState(ACTIVITY_INVISIBLE);
139 } 139 }
140 RegisterActivity(); 140 RegisterActivity();
141 } 141 }
142 return web_view_; 142 return web_view_;
143 } 143 }
144 144
145 gfx::ImageSkia AppActivity::GetOverviewModeImage() { 145 scoped_ptr<gfx::Image> AppActivity::GetOverviewModeImage() {
146 if (content_proxy_.get()) 146 if (content_proxy_.get())
147 return content_proxy_->GetContentImage(); 147 return content_proxy_->GetContentImage();
148 return gfx::ImageSkia(); 148 return scoped_ptr<gfx::Image> (new gfx::Image());
149 } 149 }
150 150
151 void AppActivity::PrepareContentsForOverview() { 151 void AppActivity::PrepareContentsForOverview() {
152 // Turn on fast resizing to avoid re-laying out the web contents when 152 // Turn on fast resizing to avoid re-laying out the web contents when
153 // entering / exiting overview mode and the content is visible. 153 // entering / exiting overview mode and the content is visible.
154 if (!content_proxy_.get()) 154 if (!content_proxy_.get())
155 web_view_->SetFastResize(true); 155 web_view_->SetFastResize(true);
156 } 156 }
157 157
158 void AppActivity::ResetContentsView() { 158 void AppActivity::ResetContentsView() {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void AppActivity::HideContentProxy() { 197 void AppActivity::HideContentProxy() {
198 content_proxy_.reset(); 198 content_proxy_.reset();
199 } 199 }
200 200
201 void AppActivity::ShowContentProxy() { 201 void AppActivity::ShowContentProxy() {
202 if (!content_proxy_.get() && web_view_) 202 if (!content_proxy_.get() && web_view_)
203 content_proxy_.reset(new ContentProxy(web_view_, this)); 203 content_proxy_.reset(new ContentProxy(web_view_, this));
204 } 204 }
205 205
206 } // namespace athena 206 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698