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

Side by Side Diff: content/shell/shell_aura.cc

Issue 11614037: Call ShowRootWindow on NativeWindow's RootWindow to display the window. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rewored patch Created 7 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 aura::client::StackingClient* Shell::stacking_client_ = NULL; 277 aura::client::StackingClient* Shell::stacking_client_ = NULL;
278 views::ViewsDelegate* Shell::views_delegate_ = NULL; 278 views::ViewsDelegate* Shell::views_delegate_ = NULL;
279 279
280 // static 280 // static
281 void Shell::PlatformInitialize() { 281 void Shell::PlatformInitialize() {
282 #if defined(OS_CHROMEOS) 282 #if defined(OS_CHROMEOS)
283 chromeos::DBusThreadManager::Initialize(); 283 chromeos::DBusThreadManager::Initialize();
284 #endif 284 #endif
285 #if defined(OS_CHROMEOS) 285 #if defined(OS_CHROMEOS)
286 stacking_client_ = new content::ShellStackingClientAsh();
287 gfx::Screen::SetScreenInstance( 286 gfx::Screen::SetScreenInstance(
288 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen); 287 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen);
288 scoped_ptr<aura::RootWindow> root_window =
289 CreateRootWindow(kTestWindowWidth, kTestWindowHeight);
290 stacking_client_ =
291 new content::ShellStackingClientAsh(root_window.Pass());
289 #else 292 #else
290 stacking_client_ = new views::DesktopStackingClient(); 293 stacking_client_ = new views::DesktopStackingClient();
291 gfx::Screen::SetScreenInstance( 294 gfx::Screen::SetScreenInstance(
292 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); 295 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
293 #endif 296 #endif
294 aura::client::SetStackingClient(stacking_client_); 297 aura::client::SetStackingClient(stacking_client_);
295 views_delegate_ = new ShellViewsDelegateAura(); 298 views_delegate_ = new ShellViewsDelegateAura();
296 } 299 }
297 300
301 // static
302 scoped_ptr<aura::RootWindow> Shell::CreateRootWindow(int width, int height) {
303 scoped_ptr<aura::RootWindow> root_window(new aura::RootWindow(
304 aura::RootWindow::CreateParams(gfx::Rect(0, 0, width, height))));
305 root_window->Init();
306 return root_window.Pass();
307 }
308
298 void Shell::PlatformExit() { 309 void Shell::PlatformExit() {
299 if (stacking_client_) 310 if (stacking_client_)
300 delete stacking_client_; 311 delete stacking_client_;
301 if (views_delegate_) 312 if (views_delegate_)
302 delete views_delegate_; 313 delete views_delegate_;
303 #if defined(OS_CHROMEOS) 314 #if defined(OS_CHROMEOS)
304 chromeos::DBusThreadManager::Shutdown(); 315 chromeos::DBusThreadManager::Shutdown();
305 #endif 316 #endif
306 aura::Env::DeleteInstance(); 317 aura::Env::DeleteInstance();
307 } 318 }
(...skipping 20 matching lines...) Expand all
328 ShellWindowDelegateView* delegate_view = 339 ShellWindowDelegateView* delegate_view =
329 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 340 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
330 delegate_view->SetAddressBarURL(url); 341 delegate_view->SetAddressBarURL(url);
331 } 342 }
332 343
333 void Shell::PlatformSetIsLoading(bool loading) { 344 void Shell::PlatformSetIsLoading(bool loading) {
334 } 345 }
335 346
336 void Shell::PlatformCreateWindow(int width, int height) { 347 void Shell::PlatformCreateWindow(int width, int height) {
337 window_widget_ = 348 window_widget_ =
338 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), 349 views::Widget::CreateWindowWithContextAndBounds(
339 gfx::Rect(0, 0, width, height)); 350 new ShellWindowDelegateView(this),
351 Shell::stacking_client_->GetDefaultParent(
352 NULL, NULL, gfx::Rect()),
353 gfx::Rect(0, 0, width, height));
340 window_ = window_widget_->GetNativeWindow(); 354 window_ = window_widget_->GetNativeWindow();
355 // RootWindow created via CreateRootWindow doesn't get a
356 // ShowRootWindow call, hence its XWindow doesn't get mapped.
357 // Explicitly call the ShowRootWindow on RootWindow for now.
358 window_->GetRootWindow()->ShowRootWindow();
341 window_widget_->Show(); 359 window_widget_->Show();
342 } 360 }
343 361
344 void Shell::PlatformSetContents() { 362 void Shell::PlatformSetContents() {
345 ShellWindowDelegateView* delegate_view = 363 ShellWindowDelegateView* delegate_view =
346 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 364 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
347 delegate_view->SetWebContents(web_contents_.get()); 365 delegate_view->SetWebContents(web_contents_.get());
348 } 366 }
349 367
350 void Shell::PlatformResizeSubViews() { 368 void Shell::PlatformResizeSubViews() {
351 } 369 }
352 370
353 void Shell::Close() { 371 void Shell::Close() {
354 window_widget_->Close(); 372 window_widget_->Close();
355 } 373 }
356 374
357 void Shell::PlatformSetTitle(const string16& title) { 375 void Shell::PlatformSetTitle(const string16& title) {
358 ShellWindowDelegateView* delegate_view = 376 ShellWindowDelegateView* delegate_view =
359 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 377 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
360 delegate_view->SetWindowTitle(title); 378 delegate_view->SetWindowTitle(title);
361 window_widget_->UpdateWindowTitle(); 379 window_widget_->UpdateWindowTitle();
362 } 380 }
363 381
364 } // namespace content 382 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698