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

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

Issue 505273002: Move app_shell specific impl from athena_lib to athena_shell_lib (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
« no previous file with comments | « athena/content/app_activity.h ('k') | athena/content/app_activity_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/app_content_control_delegate.h" 9 #include "athena/content/public/app_content_control_delegate.h"
10 #include "athena/content/public/app_registry.h" 10 #include "athena/content/public/app_registry.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "extensions/shell/browser/shell_app_window.h"
13 #include "ui/views/controls/webview/webview.h" 12 #include "ui/views/controls/webview/webview.h"
14 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
15 14
16 namespace athena { 15 namespace athena {
17 16
18 // TODO(mukai): specifies the same accelerators of WebActivity. 17 // TODO(mukai): specifies the same accelerators of WebActivity.
19 AppActivity::AppActivity(extensions::ShellAppWindow* app_window) 18 AppActivity::AppActivity()
20 : app_window_(app_window), 19 : web_view_(NULL),
21 web_view_(NULL),
22 current_state_(ACTIVITY_UNLOADED), 20 current_state_(ACTIVITY_UNLOADED),
23 app_activity_registry_(NULL) { 21 app_activity_registry_(NULL) {
24 } 22 }
25 23
26 AppActivity::~AppActivity() { 24 AppActivity::~AppActivity() {
27 // If this activity is registered, we unregister it now. 25 // If this activity is registered, we unregister it now.
28 if (app_activity_registry_) 26 if (app_activity_registry_)
29 app_activity_registry_->UnregisterAppActivity(this); 27 app_activity_registry_->UnregisterAppActivity(this);
30 } 28 }
31 29
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return web_view_->GetWebContents()->GetTitle(); 107 return web_view_->GetWebContents()->GetTitle();
110 } 108 }
111 109
112 bool AppActivity::UsesFrame() const { 110 bool AppActivity::UsesFrame() const {
113 return false; 111 return false;
114 } 112 }
115 113
116 views::View* AppActivity::GetContentsView() { 114 views::View* AppActivity::GetContentsView() {
117 if (!web_view_) { 115 if (!web_view_) {
118 // TODO(oshima): use apps::NativeAppWindowViews 116 // TODO(oshima): use apps::NativeAppWindowViews
119 content::WebContents* web_contents = 117 content::WebContents* web_contents = GetWebContents();
120 app_window_->GetAssociatedWebContents();
121 web_view_ = new views::WebView(web_contents->GetBrowserContext()); 118 web_view_ = new views::WebView(web_contents->GetBrowserContext());
122 web_view_->SetWebContents(web_contents); 119 web_view_->SetWebContents(web_contents);
123 SetCurrentState(ACTIVITY_INVISIBLE); 120 SetCurrentState(ACTIVITY_INVISIBLE);
124 Observe(web_contents); 121 Observe(web_contents);
125 overview_mode_image_ = gfx::ImageSkia(); 122 overview_mode_image_ = gfx::ImageSkia();
126 } 123 }
127 return web_view_; 124 return web_view_;
128 } 125 }
129 126
130 void AppActivity::CreateOverviewModeImage() { 127 void AppActivity::CreateOverviewModeImage() {
(...skipping 18 matching lines...) Expand all
149 const GURL& url, 146 const GURL& url,
150 content::NavigationController::ReloadType reload_type) { 147 content::NavigationController::ReloadType reload_type) {
151 if (!app_activity_registry_) 148 if (!app_activity_registry_)
152 RegisterActivity(); 149 RegisterActivity();
153 } 150 }
154 151
155 // Register an |activity| with an application. 152 // Register an |activity| with an application.
156 // Note: This should only get called once for an |app_window| of the 153 // Note: This should only get called once for an |app_window| of the
157 // |activity|. 154 // |activity|.
158 void AppActivity::RegisterActivity() { 155 void AppActivity::RegisterActivity() {
159 content::WebContents* web_contents = app_window_->GetAssociatedWebContents(); 156 content::WebContents* web_contents = GetWebContents();
160 AppRegistry* app_registry = AppRegistry::Get(); 157 AppRegistry* app_registry = AppRegistry::Get();
161 // Get the application's registry. 158 // Get the application's registry.
162 app_activity_registry_ = app_registry->GetAppActivityRegistry( 159 app_activity_registry_ = app_registry->GetAppActivityRegistry(
163 app_registry->GetDelegate()->GetApplicationID(web_contents), 160 app_registry->GetDelegate()->GetApplicationID(web_contents),
164 web_contents->GetBrowserContext()); 161 web_contents->GetBrowserContext());
165 DCHECK(app_activity_registry_); 162 DCHECK(app_activity_registry_);
166 // Register the activity. 163 // Register the activity.
167 app_activity_registry_->RegisterAppActivity(this); 164 app_activity_registry_->RegisterAppActivity(this);
168 } 165 }
169 166
170 } // namespace athena 167 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/app_activity.h ('k') | athena/content/app_activity_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698