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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 void AppActivity::HideContentProxy() { | 215 void AppActivity::HideContentProxy() { |
214 content_proxy_.reset(); | 216 content_proxy_.reset(); |
215 } | 217 } |
216 | 218 |
217 void AppActivity::ShowContentProxy() { | 219 void AppActivity::ShowContentProxy() { |
218 if (!content_proxy_.get() && web_view_) | 220 if (!content_proxy_.get() && web_view_) |
219 content_proxy_.reset(new ContentProxy(web_view_, this)); | 221 content_proxy_.reset(new ContentProxy(web_view_, this)); |
220 } | 222 } |
221 | 223 |
222 } // namespace athena | 224 } // namespace athena |
OLD | NEW |