| 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/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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 AppActivity::AppActivity(extensions::AppWindow* app_window, | 22 AppActivity::AppActivity(extensions::AppWindow* app_window, |
| 23 views::WebView* web_view) | 23 views::WebView* web_view) |
| 24 : app_id_(app_window->extension_id()), | 24 : app_id_(app_window->extension_id()), |
| 25 web_view_(web_view), | 25 web_view_(web_view), |
| 26 current_state_(ACTIVITY_UNLOADED), | 26 current_state_(ACTIVITY_UNLOADED), |
| 27 app_activity_registry_(NULL) { | 27 app_activity_registry_(NULL) { |
| 28 DCHECK_EQ(app_window->web_contents(), web_view->GetWebContents()); | 28 DCHECK_EQ(app_window->web_contents(), web_view->GetWebContents()); |
| 29 Observe(app_window->web_contents()); | 29 Observe(app_window->web_contents()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 scoped_ptr<ContentProxy> AppActivity::GetContentProxy(aura::Window* window) { | 32 scoped_ptr<ContentProxy> AppActivity::GetContentProxy() { |
| 33 // Note: After this call, the content is still valid because the contents |
| 34 // destruction will destroy this |AppActivity| object. |
| 33 if (content_proxy_.get()) | 35 if (content_proxy_.get()) |
| 34 content_proxy_->Reparent(window); | 36 content_proxy_->OnPreContentDestroyed(); |
| 35 return content_proxy_.Pass(); | 37 return content_proxy_.Pass(); |
| 36 } | 38 } |
| 37 | 39 |
| 38 ActivityViewModel* AppActivity::GetActivityViewModel() { | 40 ActivityViewModel* AppActivity::GetActivityViewModel() { |
| 39 return this; | 41 return this; |
| 40 } | 42 } |
| 41 | 43 |
| 42 void AppActivity::SetCurrentState(Activity::ActivityState state) { | 44 void AppActivity::SetCurrentState(Activity::ActivityState state) { |
| 43 DCHECK_NE(state, current_state_); | 45 DCHECK_NE(state, current_state_); |
| 44 ActivityState current_state = current_state_; | 46 ActivityState current_state = current_state_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 SetCurrentState(ACTIVITY_INVISIBLE); | 142 SetCurrentState(ACTIVITY_INVISIBLE); |
| 141 } | 143 } |
| 142 RegisterActivity(); | 144 RegisterActivity(); |
| 143 return web_view_->GetWidget(); | 145 return web_view_->GetWidget(); |
| 144 } | 146 } |
| 145 | 147 |
| 146 views::View* AppActivity::GetContentsView() { | 148 views::View* AppActivity::GetContentsView() { |
| 147 return web_view_; | 149 return web_view_; |
| 148 } | 150 } |
| 149 | 151 |
| 150 gfx::ImageSkia AppActivity::GetOverviewModeImage() { | 152 gfx::Image AppActivity::GetOverviewModeImage() { |
| 151 if (content_proxy_.get()) | 153 if (content_proxy_.get()) |
| 152 return content_proxy_->GetContentImage(); | 154 return content_proxy_->GetContentImage(); |
| 153 return gfx::ImageSkia(); | 155 return gfx::Image(); |
| 154 } | 156 } |
| 155 | 157 |
| 156 void AppActivity::PrepareContentsForOverview() { | 158 void AppActivity::PrepareContentsForOverview() { |
| 157 // Turn on fast resizing to avoid re-laying out the web contents when | 159 // Turn on fast resizing to avoid re-laying out the web contents when |
| 158 // entering / exiting overview mode and the content is visible. | 160 // entering / exiting overview mode and the content is visible. |
| 159 if (!content_proxy_.get()) | 161 if (!content_proxy_.get()) |
| 160 web_view_->SetFastResize(true); | 162 web_view_->SetFastResize(true); |
| 161 } | 163 } |
| 162 | 164 |
| 163 void AppActivity::ResetContentsView() { | 165 void AppActivity::ResetContentsView() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void AppActivity::HideContentProxy() { | 211 void AppActivity::HideContentProxy() { |
| 210 content_proxy_.reset(); | 212 content_proxy_.reset(); |
| 211 } | 213 } |
| 212 | 214 |
| 213 void AppActivity::ShowContentProxy() { | 215 void AppActivity::ShowContentProxy() { |
| 214 if (!content_proxy_.get() && web_view_) | 216 if (!content_proxy_.get() && web_view_) |
| 215 content_proxy_.reset(new ContentProxy(web_view_, this)); | 217 content_proxy_.reset(new ContentProxy(web_view_, this)); |
| 216 } | 218 } |
| 217 | 219 |
| 218 } // namespace athena | 220 } // namespace athena |
| OLD | NEW |