OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/upgrade_detector.h" | 5 #include "chrome/browser/upgrade_detector.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 } // namespace | 142 } // namespace |
143 | 143 |
144 // static | 144 // static |
145 void UpgradeDetector::RegisterPrefs(PrefService* prefs) { | 145 void UpgradeDetector::RegisterPrefs(PrefService* prefs) { |
146 prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); | 146 prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); |
147 } | 147 } |
148 | 148 |
149 UpgradeDetector::UpgradeDetector() | 149 UpgradeDetector::UpgradeDetector() |
150 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 150 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
151 notify_upgrade_(false) { | 151 notify_upgrade_(false) { |
152 CommandLine command_line(*CommandLine::ForCurrentProcess()); | |
153 if (command_line.HasSwitch(switches::kDisableBackgroundNetworking)) | |
154 return; | |
Mike Belshe
2011/04/06 18:32:53
This is great - lets put this in a separate CL.
| |
152 // Windows: only enable upgrade notifications for official builds. | 155 // Windows: only enable upgrade notifications for official builds. |
153 // Mac: only enable them if the updater (Keystone) is present. | 156 // Mac: only enable them if the updater (Keystone) is present. |
154 // Linux (and other POSIX): always enable regardless of branding. | 157 // Linux (and other POSIX): always enable regardless of branding. |
155 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX) | 158 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX) |
156 #if defined(OS_MACOSX) | 159 #if defined(OS_MACOSX) |
157 if (keystone_glue::KeystoneEnabled()) | 160 if (keystone_glue::KeystoneEnabled()) |
158 #endif | 161 #endif |
159 { | 162 { |
160 detect_upgrade_timer_.Start( | 163 detect_upgrade_timer_.Start( |
161 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), | 164 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 } | 205 } |
203 | 206 |
204 void UpgradeDetector::NotifyOnUpgrade() { | 207 void UpgradeDetector::NotifyOnUpgrade() { |
205 notify_upgrade_ = true; | 208 notify_upgrade_ = true; |
206 | 209 |
207 NotificationService::current()->Notify( | 210 NotificationService::current()->Notify( |
208 NotificationType::UPGRADE_RECOMMENDED, | 211 NotificationType::UPGRADE_RECOMMENDED, |
209 Source<UpgradeDetector>(this), | 212 Source<UpgradeDetector>(this), |
210 NotificationService::NoDetails()); | 213 NotificationService::NoDetails()); |
211 } | 214 } |
OLD | NEW |