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 | 284 #endif |
285 #if defined(OS_CHROMEOS) | 285 #if defined(OS_CHROMEOS) |
sky
2013/01/25 00:59:05
Sorry, since you're here can you merge these two d
| |
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 // Call ShowRootWindow on RootWindow created by MinimalAsh without | |
351 // which XWindow owned by RootWindow doesn't get mapped. | |
352 window_->GetRootWindow()->ShowRootWindow(); | |
350 window_widget_->Show(); | 353 window_widget_->Show(); |
351 } | 354 } |
352 | 355 |
353 void Shell::PlatformSetContents() { | 356 void Shell::PlatformSetContents() { |
354 ShellWindowDelegateView* delegate_view = | 357 ShellWindowDelegateView* delegate_view = |
355 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 358 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
356 delegate_view->SetWebContents(web_contents_.get()); | 359 delegate_view->SetWebContents(web_contents_.get()); |
357 } | 360 } |
358 | 361 |
359 void Shell::PlatformResizeSubViews() { | 362 void Shell::PlatformResizeSubViews() { |
360 } | 363 } |
361 | 364 |
362 void Shell::Close() { | 365 void Shell::Close() { |
363 window_widget_->Close(); | 366 window_widget_->Close(); |
364 } | 367 } |
365 | 368 |
366 void Shell::PlatformSetTitle(const string16& title) { | 369 void Shell::PlatformSetTitle(const string16& title) { |
367 ShellWindowDelegateView* delegate_view = | 370 ShellWindowDelegateView* delegate_view = |
368 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 371 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
369 delegate_view->SetWindowTitle(title); | 372 delegate_view->SetWindowTitle(title); |
370 window_widget_->UpdateWindowTitle(); | 373 window_widget_->UpdateWindowTitle(); |
371 } | 374 } |
372 | 375 |
373 } // namespace content | 376 } // namespace content |
OLD | NEW |