Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/upgrade_detector.cc

Issue 325433002: Elevated install of recovery component (UI part). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/upgrade_detector.h ('k') | chrome/browser/upgrade_detector_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 UpgradeDetector::~UpgradeDetector() { 73 UpgradeDetector::~UpgradeDetector() {
74 } 74 }
75 75
76 void UpgradeDetector::NotifyUpgradeDetected() { 76 void UpgradeDetector::NotifyUpgradeDetected() {
77 upgrade_detected_time_ = base::Time::Now(); 77 upgrade_detected_time_ = base::Time::Now();
78 critical_update_acknowledged_ = false; 78 critical_update_acknowledged_ = false;
79 } 79 }
80 80
81 void UpgradeDetector::NotifyUpgradeRecommended() { 81 void UpgradeDetector::NotifyUpgradeRecommended() {
82 notify_upgrade_ = true; 82 notify_upgrade_ = (upgrade_available_ != UPGRADE_AVAILABLE_NONE &&
83 upgrade_notification_stage() != UPGRADE_ANNOYANCE_NONE);
83 84
84 content::NotificationService::current()->Notify( 85 content::NotificationService::current()->Notify(
85 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 86 chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
86 content::Source<UpgradeDetector>(this), 87 content::Source<UpgradeDetector>(this),
87 content::NotificationService::NoDetails()); 88 content::NotificationService::NoDetails());
88 89
89 switch (upgrade_available_) { 90 switch (upgrade_available_) {
90 case UPGRADE_NEEDED_OUTDATED_INSTALL: { 91 case UPGRADE_NEEDED_OUTDATED_INSTALL: {
91 content::NotificationService::current()->Notify( 92 content::NotificationService::current()->Notify(
92 chrome::NOTIFICATION_OUTDATED_INSTALL, 93 chrome::NOTIFICATION_OUTDATED_INSTALL,
(...skipping 10 matching lines...) Expand all
103 } 104 }
104 case UPGRADE_AVAILABLE_CRITICAL: { 105 case UPGRADE_AVAILABLE_CRITICAL: {
105 int idle_timer = UseTestingIntervals() ? 106 int idle_timer = UseTestingIntervals() ?
106 kIdleRepeatingTimerWait : 107 kIdleRepeatingTimerWait :
107 kIdleRepeatingTimerWait * 60; // To minutes. 108 kIdleRepeatingTimerWait * 60; // To minutes.
108 idle_check_timer_.Start(FROM_HERE, 109 idle_check_timer_.Start(FROM_HERE,
109 base::TimeDelta::FromSeconds(idle_timer), 110 base::TimeDelta::FromSeconds(idle_timer),
110 this, &UpgradeDetector::CheckIdle); 111 this, &UpgradeDetector::CheckIdle);
111 break; 112 break;
112 } 113 }
114 case UPGRADE_NEEDS_ELEVATION: {
115 content::NotificationService::current()->Notify(
116 chrome::NOTIFICATION_UPGRADE_NEEDS_ELEVATION,
117 content::Source<UpgradeDetector>(this),
118 content::NotificationService::NoDetails());
119 break;
120 }
113 default: 121 default:
114 break; 122 break;
115 } 123 }
116 } 124 }
117 125
118 void UpgradeDetector::CheckIdle() { 126 void UpgradeDetector::CheckIdle() {
119 // CalculateIdleState expects an interval in seconds. 127 // CalculateIdleState expects an interval in seconds.
120 int idle_time_allowed = UseTestingIntervals() ? kIdleAmount : 128 int idle_time_allowed = UseTestingIntervals() ? kIdleAmount :
121 kIdleAmount * 60 * 60; 129 kIdleAmount * 60 * 60;
122 130
(...skipping 24 matching lines...) Expand all
147 break; 155 break;
148 case IDLE_STATE_ACTIVE: 156 case IDLE_STATE_ACTIVE:
149 case IDLE_STATE_UNKNOWN: 157 case IDLE_STATE_UNKNOWN:
150 break; 158 break;
151 default: 159 default:
152 NOTREACHED(); // Need to add any new value above (either providing 160 NOTREACHED(); // Need to add any new value above (either providing
153 // automatic restart or show notification to user). 161 // automatic restart or show notification to user).
154 break; 162 break;
155 } 163 }
156 } 164 }
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector.h ('k') | chrome/browser/upgrade_detector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698