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