| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 using views::ShellWindowDelegateView; | 271 using views::ShellWindowDelegateView; |
| 272 | 272 |
| 273 namespace content { | 273 namespace content { |
| 274 | 274 |
| 275 #if defined(OS_CHROMEOS) | 275 #if defined(OS_CHROMEOS) |
| 276 MinimalAsh* Shell::minimal_ash_ = NULL; | 276 MinimalAsh* Shell::minimal_ash_ = NULL; |
| 277 #endif | 277 #endif |
| 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(const gfx::Size& default_window_size) { |
| 282 #if defined(OS_CHROMEOS) | 282 #if defined(OS_CHROMEOS) |
| 283 chromeos::DBusThreadManager::Initialize(); | 283 chromeos::DBusThreadManager::Initialize(); |
| 284 #endif | |
| 285 #if defined(OS_CHROMEOS) | |
| 286 gfx::Screen::SetScreenInstance( | 284 gfx::Screen::SetScreenInstance( |
| 287 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen); | 285 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen); |
| 288 minimal_ash_ = new content::MinimalAsh(); | 286 minimal_ash_ = new content::MinimalAsh(default_window_size); |
| 289 #else | 287 #else |
| 290 gfx::Screen::SetScreenInstance( | 288 gfx::Screen::SetScreenInstance( |
| 291 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 289 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
| 292 #endif | 290 #endif |
| 293 views_delegate_ = new ShellViewsDelegateAura(); | 291 views_delegate_ = new ShellViewsDelegateAura(); |
| 294 } | 292 } |
| 295 | 293 |
| 296 void Shell::PlatformExit() { | 294 void Shell::PlatformExit() { |
| 297 #if defined(OS_CHROMEOS) | 295 #if defined(OS_CHROMEOS) |
| 298 if (minimal_ash_) | 296 if (minimal_ash_) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 new ShellWindowDelegateView(this), | 338 new ShellWindowDelegateView(this), |
| 341 minimal_ash_->GetDefaultParent(NULL, NULL, gfx::Rect()), | 339 minimal_ash_->GetDefaultParent(NULL, NULL, gfx::Rect()), |
| 342 gfx::Rect(0, 0, width, height)); | 340 gfx::Rect(0, 0, width, height)); |
| 343 #else | 341 #else |
| 344 window_widget_ = | 342 window_widget_ = |
| 345 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), | 343 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), |
| 346 gfx::Rect(0, 0, width, height)); | 344 gfx::Rect(0, 0, width, height)); |
| 347 #endif | 345 #endif |
| 348 | 346 |
| 349 window_ = window_widget_->GetNativeWindow(); | 347 window_ = window_widget_->GetNativeWindow(); |
| 348 // Call ShowRootWindow on RootWindow created by MinimalAsh without |
| 349 // which XWindow owned by RootWindow doesn't get mapped. |
| 350 window_->GetRootWindow()->ShowRootWindow(); |
| 350 window_widget_->Show(); | 351 window_widget_->Show(); |
| 351 } | 352 } |
| 352 | 353 |
| 353 void Shell::PlatformSetContents() { | 354 void Shell::PlatformSetContents() { |
| 354 ShellWindowDelegateView* delegate_view = | 355 ShellWindowDelegateView* delegate_view = |
| 355 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 356 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 356 delegate_view->SetWebContents(web_contents_.get()); | 357 delegate_view->SetWebContents(web_contents_.get()); |
| 357 } | 358 } |
| 358 | 359 |
| 359 void Shell::PlatformResizeSubViews() { | 360 void Shell::PlatformResizeSubViews() { |
| 360 } | 361 } |
| 361 | 362 |
| 362 void Shell::Close() { | 363 void Shell::Close() { |
| 363 window_widget_->Close(); | 364 window_widget_->Close(); |
| 364 } | 365 } |
| 365 | 366 |
| 366 void Shell::PlatformSetTitle(const string16& title) { | 367 void Shell::PlatformSetTitle(const string16& title) { |
| 367 ShellWindowDelegateView* delegate_view = | 368 ShellWindowDelegateView* delegate_view = |
| 368 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 369 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 369 delegate_view->SetWindowTitle(title); | 370 delegate_view->SetWindowTitle(title); |
| 370 window_widget_->UpdateWindowTitle(); | 371 window_widget_->UpdateWindowTitle(); |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace content | 374 } // namespace content |
| OLD | NEW |