| 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 "chrome/browser/chrome_browser_main_extra_parts_aura.h" | 5 #include "chrome/browser/chrome_browser_main_extra_parts_aura.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 12 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h" | 12 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h" |
| 13 #include "chrome/browser/ui/views/aura/screenshot_taker.h" | 13 #include "chrome/browser/ui/views/aura/screenshot_taker.h" |
| 14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/gfx/compositor/compositor_setup.h" |
| 15 | 16 |
| 16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 17 #include "chrome/browser/chromeos/system/runtime_environment.h" | 18 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 #if defined(USE_WEBKIT_COMPOSITOR) | |
| 21 #include "ui/gfx/compositor/compositor_setup.h" | |
| 22 #else | |
| 23 #include "ui/gfx/test/gfx_test_utils.h" | |
| 24 #endif | |
| 25 | |
| 26 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() | 21 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() |
| 27 : ChromeBrowserMainExtraParts() { | 22 : ChromeBrowserMainExtraParts() { |
| 28 } | 23 } |
| 29 | 24 |
| 30 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { | 25 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { |
| 31 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestCompositor)) { | 26 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestCompositor)) { |
| 32 #if defined(USE_WEBKIT_COMPOSITOR) | |
| 33 ui::SetupTestCompositor(); | 27 ui::SetupTestCompositor(); |
| 34 #else | |
| 35 ui::gfx_test_utils::SetupTestCompositor(); | |
| 36 #endif | |
| 37 } | 28 } |
| 38 | 29 |
| 39 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 40 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) | 31 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) |
| 41 aura::RootWindow::set_use_fullscreen_host_window(true); | 32 aura::RootWindow::set_use_fullscreen_host_window(true); |
| 42 #endif | 33 #endif |
| 43 | 34 |
| 44 // Shell takes ownership of ChromeShellDelegate. | 35 // Shell takes ownership of ChromeShellDelegate. |
| 45 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | 36 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); |
| 46 shell->accelerator_controller()->SetScreenshotDelegate( | 37 shell->accelerator_controller()->SetScreenshotDelegate( |
| 47 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); | 38 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); |
| 48 | 39 |
| 49 // Make sure the singleton ScreenOrientationListener object is created. | 40 // Make sure the singleton ScreenOrientationListener object is created. |
| 50 ScreenOrientationListener::GetInstance(); | 41 ScreenOrientationListener::GetInstance(); |
| 51 } | 42 } |
| 52 | 43 |
| 53 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { | 44 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { |
| 54 ash::Shell::DeleteInstance(); | 45 ash::Shell::DeleteInstance(); |
| 55 aura::RootWindow::DeleteInstance(); | 46 aura::RootWindow::DeleteInstance(); |
| 56 } | 47 } |
| OLD | NEW |