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 "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // static | 34 // static |
35 void UpgradeDetector::RegisterPrefs(PrefRegistrySimple* registry) { | 35 void UpgradeDetector::RegisterPrefs(PrefRegistrySimple* registry) { |
36 registry->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); | 36 registry->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); |
37 registry->RegisterBooleanPref(prefs::kWasRestarted, false); | 37 registry->RegisterBooleanPref(prefs::kWasRestarted, false); |
38 registry->RegisterBooleanPref(prefs::kAttemptedToEnableAutoupdate, false); | 38 registry->RegisterBooleanPref(prefs::kAttemptedToEnableAutoupdate, false); |
39 } | 39 } |
40 | 40 |
41 int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) { | 41 int UpgradeDetector::GetIconResourceID(UpgradeNotificationIconType type) { |
42 if (type == UPGRADE_ICON_TYPE_BADGE) { | 42 if (type == UPGRADE_ICON_TYPE_BADGE) { |
43 // Badges do not exist on Views and Mac OS X. | 43 // TODO(oshima): Badges no longer exist. remove this. |
44 #if !defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX) | |
45 switch (upgrade_notification_stage_) { | |
46 case UPGRADE_ANNOYANCE_NONE: | |
47 return 0; | |
48 case UPGRADE_ANNOYANCE_LOW: | |
49 return IDR_UPDATE_BADGE; | |
50 case UPGRADE_ANNOYANCE_ELEVATED: | |
51 return IDR_UPDATE_BADGE2; | |
52 case UPGRADE_ANNOYANCE_HIGH: | |
53 return IDR_UPDATE_BADGE3; | |
54 case UPGRADE_ANNOYANCE_SEVERE: | |
55 return IDR_UPDATE_BADGE3; | |
56 case UPGRADE_ANNOYANCE_CRITICAL: | |
57 return IDR_UPDATE_BADGE3; | |
58 } | |
59 #endif | |
60 NOTREACHED(); | 44 NOTREACHED(); |
61 return 0; | 45 return 0; |
62 } | 46 } |
63 | 47 |
64 switch (upgrade_notification_stage_) { | 48 switch (upgrade_notification_stage_) { |
65 case UPGRADE_ANNOYANCE_NONE: | 49 case UPGRADE_ANNOYANCE_NONE: |
66 return 0; | 50 return 0; |
67 case UPGRADE_ANNOYANCE_LOW: | 51 case UPGRADE_ANNOYANCE_LOW: |
68 return IDR_UPDATE_MENU_SEVERITY_LOW; | 52 return IDR_UPDATE_MENU_SEVERITY_LOW; |
69 case UPGRADE_ANNOYANCE_ELEVATED: | 53 case UPGRADE_ANNOYANCE_ELEVATED: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 break; | 147 break; |
164 case IDLE_STATE_ACTIVE: | 148 case IDLE_STATE_ACTIVE: |
165 case IDLE_STATE_UNKNOWN: | 149 case IDLE_STATE_UNKNOWN: |
166 break; | 150 break; |
167 default: | 151 default: |
168 NOTREACHED(); // Need to add any new value above (either providing | 152 NOTREACHED(); // Need to add any new value above (either providing |
169 // automatic restart or show notification to user). | 153 // automatic restart or show notification to user). |
170 break; | 154 break; |
171 } | 155 } |
172 } | 156 } |
OLD | NEW |