Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 aura::RootWindow* root_window = CreateRootWindow(kTestWindowWidth, kTestWindow Height); | |
|
sky
2013/01/15 21:53:49
> 80
Nayan
2013/01/15 23:39:03
Done.
| |
| 289 stacking_client_ = new content::ShellStackingClientAsh(root_window); | |
| 289 #else | 290 #else |
| 290 stacking_client_ = new views::DesktopStackingClient(); | 291 stacking_client_ = new views::DesktopStackingClient(); |
| 291 gfx::Screen::SetScreenInstance( | 292 gfx::Screen::SetScreenInstance( |
| 292 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 293 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
| 293 #endif | 294 #endif |
| 294 aura::client::SetStackingClient(stacking_client_); | 295 aura::client::SetStackingClient(stacking_client_); |
| 295 views_delegate_ = new ShellViewsDelegateAura(); | 296 views_delegate_ = new ShellViewsDelegateAura(); |
| 296 } | 297 } |
| 297 | 298 |
| 299 aura::RootWindow* Shell::CreateRootWindow(int width, int height) { | |
|
sky
2013/01/15 21:53:49
Convention for static members/methods is to put:
/
Nayan
2013/01/15 23:39:03
Done.
| |
| 300 aura::RootWindow* root_window = new aura::RootWindow( | |
| 301 aura::RootWindow::CreateParams(gfx::Rect(0, 0, width, height))); | |
| 302 root_window->Init(); | |
| 303 return root_window; | |
| 304 } | |
| 305 | |
| 298 void Shell::PlatformExit() { | 306 void Shell::PlatformExit() { |
| 299 if (stacking_client_) | 307 if (stacking_client_) |
| 300 delete stacking_client_; | 308 delete stacking_client_; |
| 301 if (views_delegate_) | 309 if (views_delegate_) |
| 302 delete views_delegate_; | 310 delete views_delegate_; |
| 303 #if defined(OS_CHROMEOS) | 311 #if defined(OS_CHROMEOS) |
| 304 chromeos::DBusThreadManager::Shutdown(); | 312 chromeos::DBusThreadManager::Shutdown(); |
| 305 #endif | 313 #endif |
| 306 aura::Env::DeleteInstance(); | 314 aura::Env::DeleteInstance(); |
| 307 } | 315 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 328 ShellWindowDelegateView* delegate_view = | 336 ShellWindowDelegateView* delegate_view = |
| 329 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 337 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 330 delegate_view->SetAddressBarURL(url); | 338 delegate_view->SetAddressBarURL(url); |
| 331 } | 339 } |
| 332 | 340 |
| 333 void Shell::PlatformSetIsLoading(bool loading) { | 341 void Shell::PlatformSetIsLoading(bool loading) { |
| 334 } | 342 } |
| 335 | 343 |
| 336 void Shell::PlatformCreateWindow(int width, int height) { | 344 void Shell::PlatformCreateWindow(int width, int height) { |
| 337 window_widget_ = | 345 window_widget_ = |
| 338 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), | 346 views::Widget::CreateWindowWithContextAndBounds(new ShellWindowDelegateVie w(this), |
|
sky
2013/01/15 21:53:49
> 80
Nayan
2013/01/15 23:39:03
Done.
| |
| 339 gfx::Rect(0, 0, width, height)); | 347 Shell::stacking_client_->G etDefaultParent(NULL, NULL, gfx::Rect()), |
| 348 gfx::Rect(0, 0, width, hei ght)); | |
| 340 window_ = window_widget_->GetNativeWindow(); | 349 window_ = window_widget_->GetNativeWindow(); |
| 350 // Explicitly call show on the root window. | |
|
sky
2013/01/15 21:53:49
This just says what the code does. Comment should
Nayan
2013/01/15 23:39:03
Done.
| |
| 351 window_->GetRootWindow()->ShowRootWindow(); | |
| 341 window_widget_->Show(); | 352 window_widget_->Show(); |
| 342 } | 353 } |
| 343 | 354 |
| 344 void Shell::PlatformSetContents() { | 355 void Shell::PlatformSetContents() { |
| 345 ShellWindowDelegateView* delegate_view = | 356 ShellWindowDelegateView* delegate_view = |
| 346 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 357 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 347 delegate_view->SetWebContents(web_contents_.get()); | 358 delegate_view->SetWebContents(web_contents_.get()); |
| 348 } | 359 } |
| 349 | 360 |
| 350 void Shell::PlatformResizeSubViews() { | 361 void Shell::PlatformResizeSubViews() { |
| 351 } | 362 } |
| 352 | 363 |
| 353 void Shell::Close() { | 364 void Shell::Close() { |
| 354 window_widget_->Close(); | 365 window_widget_->Close(); |
| 355 } | 366 } |
| 356 | 367 |
| 357 void Shell::PlatformSetTitle(const string16& title) { | 368 void Shell::PlatformSetTitle(const string16& title) { |
| 358 ShellWindowDelegateView* delegate_view = | 369 ShellWindowDelegateView* delegate_view = |
| 359 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 370 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 360 delegate_view->SetWindowTitle(title); | 371 delegate_view->SetWindowTitle(title); |
| 361 window_widget_->UpdateWindowTitle(); | 372 window_widget_->UpdateWindowTitle(); |
| 362 } | 373 } |
| 363 | 374 |
| 364 } // namespace content | 375 } // namespace content |
| OLD | NEW |