| 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/upgrade_detector.h" | 5 #include "chrome/browser/upgrade_detector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 bool UseTestingIntervals() { | 25 bool UseTestingIntervals() { |
| 26 // If a command line parameter specifying how long the upgrade check should | 26 // If a command line parameter specifying how long the upgrade check should |
| 27 // be, we assume it is for testing and switch to using seconds instead of | 27 // be, we assume it is for testing and switch to using seconds instead of |
| 28 // hours. | 28 // hours. |
| 29 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 29 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 30 return !cmd_line.GetSwitchValueASCII( | 30 return !cmd_line.GetSwitchValueASCII( |
| 31 switches::kCheckForUpdateIntervalSec).empty(); | 31 switches::kCheckForUpdateIntervalSec).empty(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 void UpgradeDetector::RegisterPrefs(PrefService* prefs) { | 35 void UpgradeDetector::RegisterPrefs(PrefServiceSimple* prefs) { |
| 36 prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); | 36 prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); |
| 37 prefs->RegisterBooleanPref(prefs::kWasRestarted, false); | 37 prefs->RegisterBooleanPref(prefs::kWasRestarted, false); |
| 38 } | 38 } |
| 39 | 39 |
| 40 int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) { | 40 int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) { |
| 41 bool badge = type == UPGRADE_ICON_TYPE_BADGE; | 41 bool badge = type == UPGRADE_ICON_TYPE_BADGE; |
| 42 switch (upgrade_notification_stage_) { | 42 switch (upgrade_notification_stage_) { |
| 43 case UPGRADE_ANNOYANCE_CRITICAL: | 43 case UPGRADE_ANNOYANCE_CRITICAL: |
| 44 // The critical annoyance state, somewhat ironically, re-purposes the | 44 // The critical annoyance state, somewhat ironically, re-purposes the |
| 45 // icon for the second highest severity state, since that state has the | 45 // icon for the second highest severity state, since that state has the |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 break; | 125 break; |
| 126 case IDLE_STATE_ACTIVE: | 126 case IDLE_STATE_ACTIVE: |
| 127 case IDLE_STATE_UNKNOWN: | 127 case IDLE_STATE_UNKNOWN: |
| 128 break; | 128 break; |
| 129 default: | 129 default: |
| 130 NOTREACHED(); // Need to add any new value above (either providing | 130 NOTREACHED(); // Need to add any new value above (either providing |
| 131 // automatic restart or show notification to user). | 131 // automatic restart or show notification to user). |
| 132 break; | 132 break; |
| 133 } | 133 } |
| 134 } | 134 } |
| OLD | NEW |