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

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

Issue 558243002: V2 app support step2 : Use NativeAppWindow for Activity's window. (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/public/app_registry.h" 9 #include "athena/content/public/app_registry.h"
10 #include "athena/wm/public/window_list_provider.h" 10 #include "athena/wm/public/window_list_provider.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 base::string16 AppActivity::GetTitle() const { 109 base::string16 AppActivity::GetTitle() const {
110 return web_view_->GetWebContents()->GetTitle(); 110 return web_view_->GetWebContents()->GetTitle();
111 } 111 }
112 112
113 bool AppActivity::UsesFrame() const { 113 bool AppActivity::UsesFrame() const {
114 return false; 114 return false;
115 } 115 }
116 116
117 views::View* AppActivity::GetContentsView() { 117 views::View* AppActivity::GetContentsView() {
118 if (!web_view_) { 118 if (!web_view_) {
119 // TODO(oshima): use apps::NativeAppWindowViews 119 web_view_ = GetWebView();
120 content::WebContents* web_contents = GetWebContents();
121 web_view_ = new views::WebView(web_contents->GetBrowserContext());
122 web_view_->SetWebContents(web_contents);
123 // Make sure the content gets properly shown. 120 // Make sure the content gets properly shown.
124 if (current_state_ == ACTIVITY_VISIBLE) { 121 if (current_state_ == ACTIVITY_VISIBLE) {
125 MakeVisible(); 122 MakeVisible();
126 } else if (current_state_ == ACTIVITY_INVISIBLE) { 123 } else if (current_state_ == ACTIVITY_INVISIBLE) {
127 MakeInvisible(); 124 MakeInvisible();
128 } else { 125 } else {
129 // If not previously specified, we change the state now to invisible.. 126 // If not previously specified, we change the state now to invisible..
130 SetCurrentState(ACTIVITY_INVISIBLE); 127 SetCurrentState(ACTIVITY_INVISIBLE);
131 } 128 }
132 Observe(web_contents);
133 RegisterActivity(); 129 RegisterActivity();
134 } 130 }
135 return web_view_; 131 return web_view_;
136 } 132 }
137 133
138 void AppActivity::CreateOverviewModeImage() { 134 void AppActivity::CreateOverviewModeImage() {
139 // TODO(skuhne): Implement this! 135 // TODO(skuhne): Implement this!
140 } 136 }
141 137
142 gfx::ImageSkia AppActivity::GetOverviewModeImage() { 138 gfx::ImageSkia AppActivity::GetOverviewModeImage() {
(...skipping 24 matching lines...) Expand all
167 163
168 void AppActivity::DidUpdateFaviconURL( 164 void AppActivity::DidUpdateFaviconURL(
169 const std::vector<content::FaviconURL>& candidates) { 165 const std::vector<content::FaviconURL>& candidates) {
170 ActivityManager::Get()->UpdateActivity(this); 166 ActivityManager::Get()->UpdateActivity(this);
171 } 167 }
172 168
173 // Register an |activity| with an application. 169 // Register an |activity| with an application.
174 // Note: This should only get called once for an |app_window| of the 170 // Note: This should only get called once for an |app_window| of the
175 // |activity|. 171 // |activity|.
176 void AppActivity::RegisterActivity() { 172 void AppActivity::RegisterActivity() {
177 content::WebContents* web_contents = GetWebContents(); 173 content::WebContents* web_contents = web_view_->GetWebContents();
178 AppRegistry* app_registry = AppRegistry::Get(); 174 AppRegistry* app_registry = AppRegistry::Get();
179 // Get the application's registry. 175 // Get the application's registry.
180 app_activity_registry_ = app_registry->GetAppActivityRegistry( 176 app_activity_registry_ = app_registry->GetAppActivityRegistry(
181 app_id_, web_contents->GetBrowserContext()); 177 app_id_, web_contents->GetBrowserContext());
182 DCHECK(app_activity_registry_); 178 DCHECK(app_activity_registry_);
183 // Register the activity. 179 // Register the activity.
184 app_activity_registry_->RegisterAppActivity(this); 180 app_activity_registry_->RegisterAppActivity(this);
185 } 181 }
186 182
187 void AppActivity::MakeVisible() { 183 void AppActivity::MakeVisible() {
(...skipping 24 matching lines...) Expand all
212 overview_mode_image_ = gfx::ImageSkia(); 208 overview_mode_image_ = gfx::ImageSkia();
213 } 209 }
214 // Now we can hide this. 210 // Now we can hide this.
215 // Note: This might have to be done asynchronously after the readback took 211 // Note: This might have to be done asynchronously after the readback took
216 // place. 212 // place.
217 web_view_->SetVisible(false); 213 web_view_->SetVisible(false);
218 web_view_->GetWebContents()->GetNativeView()->Hide(); 214 web_view_->GetWebContents()->GetNativeView()->Hide();
219 } 215 }
220 216
221 } // namespace athena 217 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698