| 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_linux.h" | 5 #include "chrome/browser/chrome_browser_main_linux.h" |
| 6 | 6 |
| 7 #if !defined(OS_CHROMEOS) | 7 #if !defined(OS_CHROMEOS) |
| 8 #include "chrome/browser/media_gallery/media_device_notifications_linux.h" | 8 #include "chrome/browser/media_gallery/media_device_notifications_linux.h" |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/chrome_version_info.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #endif // defined(USE_LINUX_BREAKPAD) | 28 #endif // defined(USE_LINUX_BREAKPAD) |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 #if defined(USE_LINUX_BREAKPAD) | 32 #if defined(USE_LINUX_BREAKPAD) |
| 33 #if defined(OS_CHROMEOS) |
| 34 void ChromeOSVersionCallback(chromeos::VersionLoader::Handle, |
| 35 const std::string& version) { |
| 36 base::SetLinuxDistro(std::string("CrOS ") + version); |
| 37 } |
| 38 #else |
| 33 void GetLinuxDistroCallback() { | 39 void GetLinuxDistroCallback() { |
| 34 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. | 40 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. |
| 35 } | 41 } |
| 42 #endif |
| 36 | 43 |
| 37 bool IsCrashReportingEnabled(const PrefService* local_state) { | 44 bool IsCrashReportingEnabled(const PrefService* local_state) { |
| 38 // Check whether we should initialize the crash reporter. It may be disabled | 45 // Check whether we should initialize the crash reporter. It may be disabled |
| 39 // through configuration policy or user preference. It must be disabled for | 46 // through configuration policy or user preference. It must be disabled for |
| 40 // Guest mode on Chrome OS in Stable channel. | 47 // Guest mode on Chrome OS in Stable channel. |
| 41 // The kHeadless environment variable overrides the decision, but only if the | 48 // The kHeadless environment variable overrides the decision, but only if the |
| 42 // crash service is under control of the user. It is used by QA testing | 49 // crash service is under control of the user. It is used by QA testing |
| 43 // infrastructure to switch on generation of crash reports. | 50 // infrastructure to switch on generation of crash reports. |
| 44 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 45 bool is_guest_session = | 52 bool is_guest_session = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 72 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( | 79 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( |
| 73 const content::MainFunctionParams& parameters) | 80 const content::MainFunctionParams& parameters) |
| 74 : ChromeBrowserMainPartsPosix(parameters) { | 81 : ChromeBrowserMainPartsPosix(parameters) { |
| 75 } | 82 } |
| 76 | 83 |
| 77 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { | 84 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { |
| 78 } | 85 } |
| 79 | 86 |
| 80 void ChromeBrowserMainPartsLinux::PreProfileInit() { | 87 void ChromeBrowserMainPartsLinux::PreProfileInit() { |
| 81 #if defined(USE_LINUX_BREAKPAD) | 88 #if defined(USE_LINUX_BREAKPAD) |
| 89 #if defined(OS_CHROMEOS) |
| 90 cros_version_loader_.GetVersion(&cros_consumer_, |
| 91 base::Bind(&ChromeOSVersionCallback), |
| 92 chromeos::VersionLoader::VERSION_FULL); |
| 93 #else |
| 82 // Needs to be called after we have chrome::DIR_USER_DATA and | 94 // Needs to be called after we have chrome::DIR_USER_DATA and |
| 83 // g_browser_process. This happens in PreCreateThreads. | 95 // g_browser_process. This happens in PreCreateThreads. |
| 84 content::BrowserThread::PostTask(content::BrowserThread::FILE, | 96 content::BrowserThread::PostTask(content::BrowserThread::FILE, |
| 85 FROM_HERE, | 97 FROM_HERE, |
| 86 base::Bind(&GetLinuxDistroCallback)); | 98 base::Bind(&GetLinuxDistroCallback)); |
| 99 #endif |
| 87 | 100 |
| 88 if (IsCrashReportingEnabled(local_state())) | 101 if (IsCrashReportingEnabled(local_state())) |
| 89 InitCrashReporter(); | 102 InitCrashReporter(); |
| 90 #endif | 103 #endif |
| 91 | 104 |
| 92 #if !defined(OS_CHROMEOS) | 105 #if !defined(OS_CHROMEOS) |
| 93 const FilePath kDefaultMtabPath("/etc/mtab"); | 106 const FilePath kDefaultMtabPath("/etc/mtab"); |
| 94 media_device_notifications_linux_ = | 107 media_device_notifications_linux_ = |
| 95 new chrome::MediaDeviceNotificationsLinux(kDefaultMtabPath); | 108 new chrome::MediaDeviceNotificationsLinux(kDefaultMtabPath); |
| 96 media_device_notifications_linux_->Init(); | 109 media_device_notifications_linux_->Init(); |
| 97 #endif | 110 #endif |
| 98 | 111 |
| 99 ChromeBrowserMainPartsPosix::PreProfileInit(); | 112 ChromeBrowserMainPartsPosix::PreProfileInit(); |
| 100 } | 113 } |
| 101 | 114 |
| 102 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 115 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
| 103 #if !defined(OS_CHROMEOS) | 116 #if !defined(OS_CHROMEOS) |
| 104 // Release it now. Otherwise the FILE thread would be gone when we try to | 117 // Release it now. Otherwise the FILE thread would be gone when we try to |
| 105 // release it in the dtor and Valgrind would report a leak on almost ever | 118 // release it in the dtor and Valgrind would report a leak on almost ever |
| 106 // single browser_test. | 119 // single browser_test. |
| 107 media_device_notifications_linux_ = NULL; | 120 media_device_notifications_linux_ = NULL; |
| 108 #endif | 121 #endif |
| 109 | 122 |
| 110 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 123 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
| 111 } | 124 } |
| OLD | NEW |