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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/chrome_browser_main.h" | 9 #include "chrome/browser/chrome_browser_main.h" |
10 #include "chrome/browser/ui/aura/active_desktop_monitor.h" | 10 #include "chrome/browser/ui/aura/active_desktop_monitor.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) | 58 if (profile && !profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme)) |
59 return ui::NativeThemeAura::instance(); | 59 return ui::NativeThemeAura::instance(); |
60 | 60 |
61 return NULL; | 61 return NULL; |
62 } | 62 } |
63 #endif | 63 #endif |
64 | 64 |
65 #if !defined(OS_CHROMEOS) && defined(USE_ASH) | 65 #if !defined(OS_CHROMEOS) && defined(USE_ASH) |
66 // Returns the desktop this process was initially launched in. | 66 // Returns the desktop this process was initially launched in. |
67 chrome::HostDesktopType GetInitialDesktop() { | 67 ui::HostDesktopType GetInitialDesktop() { |
68 #if defined(OS_WIN) && defined(USE_ASH) | 68 #if defined(OS_WIN) && defined(USE_ASH) |
69 const base::CommandLine* command_line = | 69 const base::CommandLine* command_line = |
70 base::CommandLine::ForCurrentProcess(); | 70 base::CommandLine::ForCurrentProcess(); |
71 if (command_line->HasSwitch(switches::kViewerConnect) || | 71 if (command_line->HasSwitch(switches::kViewerConnect) || |
72 command_line->HasSwitch(switches::kViewerLaunchViaAppId)) { | 72 command_line->HasSwitch(switches::kViewerLaunchViaAppId)) { |
73 return chrome::HOST_DESKTOP_TYPE_ASH; | 73 return ui::HOST_DESKTOP_TYPE_ASH; |
74 } | 74 } |
75 #elif defined(OS_LINUX) | 75 #elif defined(OS_LINUX) |
76 const base::CommandLine* command_line = | 76 const base::CommandLine* command_line = |
77 base::CommandLine::ForCurrentProcess(); | 77 base::CommandLine::ForCurrentProcess(); |
78 if (command_line->HasSwitch(switches::kOpenAsh)) | 78 if (command_line->HasSwitch(switches::kOpenAsh)) |
79 return chrome::HOST_DESKTOP_TYPE_ASH; | 79 return ui::HOST_DESKTOP_TYPE_ASH; |
80 #endif | 80 #endif |
81 | 81 |
82 return chrome::HOST_DESKTOP_TYPE_NATIVE; | 82 return ui::HOST_DESKTOP_TYPE_NATIVE; |
83 } | 83 } |
84 #endif // !defined(OS_CHROMEOS) && defined(USE_ASH) | 84 #endif // !defined(OS_CHROMEOS) && defined(USE_ASH) |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { | 88 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() { |
89 } | 89 } |
90 | 90 |
91 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { | 91 ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { |
92 } | 92 } |
93 | 93 |
94 void ChromeBrowserMainExtraPartsAura::PreEarlyInitialization() { | 94 void ChromeBrowserMainExtraPartsAura::PreEarlyInitialization() { |
95 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 95 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
96 if (GetInitialDesktop() != chrome::HOST_DESKTOP_TYPE_ASH) { | 96 if (GetInitialDesktop() != ui::HOST_DESKTOP_TYPE_ASH) { |
97 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. | 97 // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. |
98 views::LinuxUI* gtk2_ui = BuildGtk2UI(); | 98 views::LinuxUI* gtk2_ui = BuildGtk2UI(); |
99 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); | 99 gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); |
100 views::LinuxUI::SetInstance(gtk2_ui); | 100 views::LinuxUI::SetInstance(gtk2_ui); |
101 } else { | 101 } else { |
102 // TODO(erg): Eventually, we'll need to somehow support IMEs in ash on | 102 // TODO(erg): Eventually, we'll need to somehow support IMEs in ash on |
103 // Linux. | 103 // Linux. |
104 ui::InitializeInputMethodForTesting(); | 104 ui::InitializeInputMethodForTesting(); |
105 } | 105 } |
106 #endif | 106 #endif |
107 } | 107 } |
108 | 108 |
109 void ChromeBrowserMainExtraPartsAura::ToolkitInitialized() { | 109 void ChromeBrowserMainExtraPartsAura::ToolkitInitialized() { |
110 #if !defined(OS_CHROMEOS) | 110 #if !defined(OS_CHROMEOS) |
111 #if defined(USE_ASH) | 111 #if defined(USE_ASH) |
112 CHECK(aura::Env::GetInstance()); | 112 CHECK(aura::Env::GetInstance()); |
113 active_desktop_monitor_.reset(new ActiveDesktopMonitor(GetInitialDesktop())); | 113 active_desktop_monitor_.reset(new ActiveDesktopMonitor(GetInitialDesktop())); |
114 #endif | 114 #endif |
115 #endif | 115 #endif |
116 | 116 |
117 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 117 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
118 if (GetInitialDesktop() != chrome::HOST_DESKTOP_TYPE_ASH) | 118 if (GetInitialDesktop() != ui::HOST_DESKTOP_TYPE_ASH) |
119 views::LinuxUI::instance()->Initialize(); | 119 views::LinuxUI::instance()->Initialize(); |
120 #endif | 120 #endif |
121 } | 121 } |
122 | 122 |
123 void ChromeBrowserMainExtraPartsAura::PreCreateThreads() { | 123 void ChromeBrowserMainExtraPartsAura::PreCreateThreads() { |
124 #if !defined(OS_CHROMEOS) | 124 #if !defined(OS_CHROMEOS) |
125 #if defined(USE_ASH) | 125 #if defined(USE_ASH) |
126 if (!chrome::ShouldOpenAshOnStartup()) | 126 if (!chrome::ShouldOpenAshOnStartup()) |
127 #endif | 127 #endif |
128 { | 128 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 chrome::MESSAGE_BOX_TYPE_WARNING); | 172 chrome::MESSAGE_BOX_TYPE_WARNING); |
173 | 173 |
174 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 174 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
175 // per_compositor_data_.empty() when quit is chosen. | 175 // per_compositor_data_.empty() when quit is chosen. |
176 base::RunLoop().RunUntilIdle(); | 176 base::RunLoop().RunUntilIdle(); |
177 | 177 |
178 exit(EXIT_FAILURE); | 178 exit(EXIT_FAILURE); |
179 } | 179 } |
180 } | 180 } |
181 #endif | 181 #endif |
OLD | NEW |