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 std::string version) | |
brettw
2012/08/14 19:42:32
Can you make this a const ref? I know you didn't a
Rick Byers
2012/08/14 20:07:00
I don't think so. CancelableRequest dispatches th
brettw
2012/08/14 20:08:52
Bind should know to copy const ref args.
| |
36 { | |
brettw
2012/08/14 19:42:32
Check { placement.
Rick Byers
2012/08/14 20:07:00
Done.
| |
37 base::SetLinuxDistro(std::string("CrOS ") + version); | |
38 } | |
39 #else | |
33 void GetLinuxDistroCallback() { | 40 void GetLinuxDistroCallback() { |
34 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. | 41 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. |
35 } | 42 } |
43 #endif | |
36 | 44 |
37 bool IsCrashReportingEnabled(const PrefService* local_state) { | 45 bool IsCrashReportingEnabled(const PrefService* local_state) { |
38 // Check whether we should initialize the crash reporter. It may be disabled | 46 // Check whether we should initialize the crash reporter. It may be disabled |
39 // through configuration policy or user preference. It must be disabled for | 47 // through configuration policy or user preference. It must be disabled for |
40 // Guest mode on Chrome OS in Stable channel. | 48 // Guest mode on Chrome OS in Stable channel. |
41 // The kHeadless environment variable overrides the decision, but only if the | 49 // 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 | 50 // crash service is under control of the user. It is used by QA testing |
43 // infrastructure to switch on generation of crash reports. | 51 // infrastructure to switch on generation of crash reports. |
44 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
45 bool is_guest_session = | 53 bool is_guest_session = |
(...skipping 26 matching lines...) Expand all Loading... | |
72 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( | 80 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( |
73 const content::MainFunctionParams& parameters) | 81 const content::MainFunctionParams& parameters) |
74 : ChromeBrowserMainPartsPosix(parameters) { | 82 : ChromeBrowserMainPartsPosix(parameters) { |
75 } | 83 } |
76 | 84 |
77 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { | 85 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { |
78 } | 86 } |
79 | 87 |
80 void ChromeBrowserMainPartsLinux::PreProfileInit() { | 88 void ChromeBrowserMainPartsLinux::PreProfileInit() { |
81 #if defined(USE_LINUX_BREAKPAD) | 89 #if defined(USE_LINUX_BREAKPAD) |
90 #if defined(OS_CHROMEOS) | |
91 cros_version_loader_.GetVersion(&cros_consumer_, | |
92 base::Bind(&ChromeOSVersionCallback), | |
93 chromeos::VersionLoader::VERSION_FULL); | |
94 #else | |
82 // Needs to be called after we have chrome::DIR_USER_DATA and | 95 // Needs to be called after we have chrome::DIR_USER_DATA and |
83 // g_browser_process. This happens in PreCreateThreads. | 96 // g_browser_process. This happens in PreCreateThreads. |
84 content::BrowserThread::PostTask(content::BrowserThread::FILE, | 97 content::BrowserThread::PostTask(content::BrowserThread::FILE, |
85 FROM_HERE, | 98 FROM_HERE, |
86 base::Bind(&GetLinuxDistroCallback)); | 99 base::Bind(&GetLinuxDistroCallback)); |
100 #endif | |
87 | 101 |
88 if (IsCrashReportingEnabled(local_state())) | 102 if (IsCrashReportingEnabled(local_state())) |
89 InitCrashReporter(); | 103 InitCrashReporter(); |
90 #endif | 104 #endif |
91 | 105 |
92 #if !defined(OS_CHROMEOS) | 106 #if !defined(OS_CHROMEOS) |
93 const FilePath kDefaultMtabPath("/etc/mtab"); | 107 const FilePath kDefaultMtabPath("/etc/mtab"); |
94 media_device_notifications_linux_ = | 108 media_device_notifications_linux_ = |
95 new chrome::MediaDeviceNotificationsLinux(kDefaultMtabPath); | 109 new chrome::MediaDeviceNotificationsLinux(kDefaultMtabPath); |
96 media_device_notifications_linux_->Init(); | 110 media_device_notifications_linux_->Init(); |
97 #endif | 111 #endif |
98 | 112 |
99 ChromeBrowserMainPartsPosix::PreProfileInit(); | 113 ChromeBrowserMainPartsPosix::PreProfileInit(); |
100 } | 114 } |
101 | 115 |
102 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 116 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
103 #if !defined(OS_CHROMEOS) | 117 #if !defined(OS_CHROMEOS) |
104 // Release it now. Otherwise the FILE thread would be gone when we try to | 118 // 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 | 119 // release it in the dtor and Valgrind would report a leak on almost ever |
106 // single browser_test. | 120 // single browser_test. |
107 media_device_notifications_linux_ = NULL; | 121 media_device_notifications_linux_ = NULL; |
108 #endif | 122 #endif |
109 | 123 |
110 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 124 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
111 } | 125 } |
OLD | NEW |