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/ui/aura/chrome_browser_main_extra_parts_aura.h" | 5 #include "chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.h" |
6 | 6 |
7 #include "chrome/browser/chrome_browser_main.h" | 7 #include "chrome/browser/chrome_browser_main.h" |
8 #include "chrome/browser/toolkit_extra_parts.h" | 8 #include "chrome/browser/toolkit_extra_parts.h" |
9 #include "ui/aura/desktop/desktop_screen.h" | 9 #include "ui/aura/desktop/desktop_screen.h" |
10 #include "ui/aura/desktop/desktop_stacking_client.h" | 10 #include "ui/aura/desktop/desktop_stacking_client.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/single_display_manager.h" | |
13 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
14 #include "ui/views/widget/native_widget_aura.h" | 13 #include "ui/views/widget/native_widget_aura.h" |
15 | 14 |
16 #if defined(OS_LINUX) | 15 #if defined(OS_LINUX) |
17 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 16 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
18 #include "ui/base/linux_ui.h" | 17 #include "ui/base/linux_ui.h" |
19 #endif | 18 #endif |
20 | 19 |
21 #if defined(USE_ASH) | 20 #if defined(USE_ASH) |
22 #include "chrome/browser/ui/ash/ash_init.h" | 21 #include "chrome/browser/ui/ash/ash_init.h" |
23 #endif | 22 #endif |
24 | 23 |
25 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { | 24 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { |
26 } | 25 } |
27 | 26 |
28 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { | 27 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { |
29 } | 28 } |
30 | 29 |
31 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { | 30 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { |
32 #if !defined(OS_CHROMEOS) | 31 #if !defined(OS_CHROMEOS) |
33 #if defined(USE_ASH) | 32 #if defined(USE_ASH) |
34 if (!chrome::ShouldOpenAshOnStartup()) | 33 if (!chrome::ShouldOpenAshOnStartup()) |
35 #endif | 34 #endif |
36 { | 35 { |
37 gfx::Screen::SetScreenInstance( | 36 gfx::Screen::SetScreenInstance( |
38 gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen()); | 37 gfx::SCREEN_TYPE_NATIVE, aura::CreateDesktopScreen()); |
39 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | |
40 stacking_client_.reset(new aura::DesktopStackingClient); | 38 stacking_client_.reset(new aura::DesktopStackingClient); |
41 } | 39 } |
42 #endif | 40 #endif |
43 | 41 |
44 #if !defined(USE_ASH) && defined(OS_LINUX) | 42 #if !defined(USE_ASH) && defined(OS_LINUX) |
45 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. | 43 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. |
46 ui::LinuxUI::SetInstance(BuildGtk2UI()); | 44 ui::LinuxUI::SetInstance(BuildGtk2UI()); |
47 #endif | 45 #endif |
48 } | 46 } |
49 | 47 |
50 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { | 48 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { |
51 stacking_client_.reset(); | 49 stacking_client_.reset(); |
52 | 50 |
53 // aura::Env instance is deleted in BrowserProcessImpl::StartTearDown | 51 // aura::Env instance is deleted in BrowserProcessImpl::StartTearDown |
54 // after the metrics service is deleted. | 52 // after the metrics service is deleted. |
55 } | 53 } |
56 | 54 |
57 namespace chrome { | 55 namespace chrome { |
58 | 56 |
59 void AddAuraToolkitExtraParts(ChromeBrowserMainParts* main_parts) { | 57 void AddAuraToolkitExtraParts(ChromeBrowserMainParts* main_parts) { |
60 main_parts->AddParts(new ChromeBrowserMainExtraPartsAura()); | 58 main_parts->AddParts(new ChromeBrowserMainExtraPartsAura()); |
61 } | 59 } |
62 | 60 |
63 } // namespace chrome | 61 } // namespace chrome |
OLD | NEW |