| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return ui::NativeThemeAura::instance(); | 56 return ui::NativeThemeAura::instance(); |
| 57 | 57 |
| 58 return NULL; | 58 return NULL; |
| 59 } | 59 } |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 #if !defined(OS_CHROMEOS) && defined(USE_ASH) | 62 #if !defined(OS_CHROMEOS) && defined(USE_ASH) |
| 63 // Returns the desktop this process was initially launched in. | 63 // Returns the desktop this process was initially launched in. |
| 64 chrome::HostDesktopType GetInitialDesktop() { | 64 chrome::HostDesktopType GetInitialDesktop() { |
| 65 #if defined(OS_WIN) && defined(USE_ASH) | 65 #if defined(OS_WIN) && defined(USE_ASH) |
| 66 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 66 const base::CommandLine* command_line = |
| 67 base::CommandLine::ForCurrentProcess(); |
| 67 if (command_line->HasSwitch(switches::kViewerConnect) || | 68 if (command_line->HasSwitch(switches::kViewerConnect) || |
| 68 command_line->HasSwitch(switches::kViewerLaunchViaAppId)) { | 69 command_line->HasSwitch(switches::kViewerLaunchViaAppId)) { |
| 69 return chrome::HOST_DESKTOP_TYPE_ASH; | 70 return chrome::HOST_DESKTOP_TYPE_ASH; |
| 70 } | 71 } |
| 71 #elif defined(OS_LINUX) | 72 #elif defined(OS_LINUX) |
| 72 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 73 const base::CommandLine* command_line = |
| 74 base::CommandLine::ForCurrentProcess(); |
| 73 if (command_line->HasSwitch(switches::kOpenAsh)) | 75 if (command_line->HasSwitch(switches::kOpenAsh)) |
| 74 return chrome::HOST_DESKTOP_TYPE_ASH; | 76 return chrome::HOST_DESKTOP_TYPE_ASH; |
| 75 #endif | 77 #endif |
| 76 | 78 |
| 77 return chrome::HOST_DESKTOP_TYPE_NATIVE; | 79 return chrome::HOST_DESKTOP_TYPE_NATIVE; |
| 78 } | 80 } |
| 79 #endif // !defined(OS_CHROMEOS) && defined(USE_ASH) | 81 #endif // !defined(OS_CHROMEOS) && defined(USE_ASH) |
| 80 | 82 |
| 81 } // namespace | 83 } // namespace |
| 82 | 84 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { | 140 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { |
| 139 active_desktop_monitor_.reset(); | 141 active_desktop_monitor_.reset(); |
| 140 | 142 |
| 141 // aura::Env instance is deleted in BrowserProcessImpl::StartTearDown | 143 // aura::Env instance is deleted in BrowserProcessImpl::StartTearDown |
| 142 // after the metrics service is deleted. | 144 // after the metrics service is deleted. |
| 143 } | 145 } |
| 144 | 146 |
| 145 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 147 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 146 void ChromeBrowserMainExtraPartsAura::DetectRunningAsRoot() { | 148 void ChromeBrowserMainExtraPartsAura::DetectRunningAsRoot() { |
| 147 if (getuid() == 0) { | 149 if (getuid() == 0) { |
| 148 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 150 const base::CommandLine& command_line = |
| 151 *base::CommandLine::ForCurrentProcess(); |
| 149 if (command_line.HasSwitch(switches::kUserDataDir)) | 152 if (command_line.HasSwitch(switches::kUserDataDir)) |
| 150 return; | 153 return; |
| 151 | 154 |
| 152 base::string16 title = l10n_util::GetStringFUTF16( | 155 base::string16 title = l10n_util::GetStringFUTF16( |
| 153 IDS_REFUSE_TO_RUN_AS_ROOT, | 156 IDS_REFUSE_TO_RUN_AS_ROOT, |
| 154 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 157 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 155 base::string16 message = l10n_util::GetStringFUTF16( | 158 base::string16 message = l10n_util::GetStringFUTF16( |
| 156 IDS_REFUSE_TO_RUN_AS_ROOT_2, | 159 IDS_REFUSE_TO_RUN_AS_ROOT_2, |
| 157 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 160 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 158 | 161 |
| 159 chrome::ShowMessageBox(NULL, | 162 chrome::ShowMessageBox(NULL, |
| 160 title, | 163 title, |
| 161 message, | 164 message, |
| 162 chrome::MESSAGE_BOX_TYPE_WARNING); | 165 chrome::MESSAGE_BOX_TYPE_WARNING); |
| 163 | 166 |
| 164 // Avoids gpu_process_transport_factory.cc(153)] Check failed: | 167 // Avoids gpu_process_transport_factory.cc(153)] Check failed: |
| 165 // per_compositor_data_.empty() when quit is chosen. | 168 // per_compositor_data_.empty() when quit is chosen. |
| 166 base::RunLoop().RunUntilIdle(); | 169 base::RunLoop().RunUntilIdle(); |
| 167 | 170 |
| 168 exit(EXIT_FAILURE); | 171 exit(EXIT_FAILURE); |
| 169 } | 172 } |
| 170 } | 173 } |
| 171 #endif | 174 #endif |
| OLD | NEW |