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

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

Issue 2925973002: Migrate upgrade notifications to observer (Closed)
Patch Set: Add DISALLOW_COPY_AND_ASSIGN Created 3 years, 6 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
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | chrome/browser/upgrade_detector_impl_unittest.cc » ('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_impl.h" 5 #include "chrome/browser/upgrade_detector_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_HIGH); 487 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_HIGH);
488 } else if (time_passed >= elevated_threshold) { 488 } else if (time_passed >= elevated_threshold) {
489 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_ELEVATED); 489 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_ELEVATED);
490 } else if (time_passed >= low_threshold) { 490 } else if (time_passed >= low_threshold) {
491 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW); 491 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW);
492 } else { 492 } else {
493 return; // Not ready to recommend upgrade. 493 return; // Not ready to recommend upgrade.
494 } 494 }
495 } 495 }
496 496
497 NotifyUpgradeRecommended(); 497 NotifyUpgrade();
498 } 498 }
499 499
500 void UpgradeDetectorImpl::NotifyOnUpgrade() { 500 void UpgradeDetectorImpl::NotifyOnUpgrade() {
501 const base::TimeDelta time_passed = 501 const base::TimeDelta time_passed =
502 base::TimeTicks::Now() - upgrade_detected_time_; 502 base::TimeTicks::Now() - upgrade_detected_time_;
503 NotifyOnUpgradeWithTimePassed(time_passed); 503 NotifyOnUpgradeWithTimePassed(time_passed);
504 } 504 }
505 505
506 // static 506 // static
507 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 507 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
508 return base::Singleton<UpgradeDetectorImpl>::get(); 508 return base::Singleton<UpgradeDetectorImpl>::get();
509 } 509 }
510 510
511 // static 511 // static
512 UpgradeDetector* UpgradeDetector::GetInstance() { 512 UpgradeDetector* UpgradeDetector::GetInstance() {
513 return UpgradeDetectorImpl::GetInstance(); 513 return UpgradeDetectorImpl::GetInstance();
514 } 514 }
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector.cc ('k') | chrome/browser/upgrade_detector_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698