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

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

Issue 5711001: Add a new GetInstance() method for remaining files with singleton classes under chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 detect_upgrade_timer_.Start( 160 detect_upgrade_timer_.Start(
161 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), 161 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
162 this, &UpgradeDetector::CheckForUpgrade); 162 this, &UpgradeDetector::CheckForUpgrade);
163 } 163 }
164 #endif 164 #endif
165 } 165 }
166 166
167 UpgradeDetector::~UpgradeDetector() { 167 UpgradeDetector::~UpgradeDetector() {
168 } 168 }
169 169
170 // static
171 UpgradeDetector* UpgradeDetector::GetInstance() {
172 return Singleton<UpgradeDetector>::get();
173 }
174
170 void UpgradeDetector::CheckForUpgrade() { 175 void UpgradeDetector::CheckForUpgrade() {
171 method_factory_.RevokeAll(); 176 method_factory_.RevokeAll();
172 Task* callback_task = 177 Task* callback_task =
173 method_factory_.NewRunnableMethod(&UpgradeDetector::UpgradeDetected); 178 method_factory_.NewRunnableMethod(&UpgradeDetector::UpgradeDetected);
174 // We use FILE as the thread to run the upgrade detection code on all 179 // We use FILE as the thread to run the upgrade detection code on all
175 // platforms. For Linux, this is because we don't want to block the UI thread 180 // platforms. For Linux, this is because we don't want to block the UI thread
176 // while launching a background process and reading its output; on the Mac and 181 // while launching a background process and reading its output; on the Mac and
177 // on Windows checking for an upgrade requires reading a file. 182 // on Windows checking for an upgrade requires reading a file.
178 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 183 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
179 new DetectUpgradeTask(callback_task)); 184 new DetectUpgradeTask(callback_task));
(...skipping 17 matching lines...) Expand all
197 } 202 }
198 203
199 void UpgradeDetector::NotifyOnUpgrade() { 204 void UpgradeDetector::NotifyOnUpgrade() {
200 notify_upgrade_ = true; 205 notify_upgrade_ = true;
201 206
202 NotificationService::current()->Notify( 207 NotificationService::current()->Notify(
203 NotificationType::UPGRADE_RECOMMENDED, 208 NotificationType::UPGRADE_RECOMMENDED,
204 Source<UpgradeDetector>(this), 209 Source<UpgradeDetector>(this),
205 NotificationService::NoDetails()); 210 NotificationService::NoDetails());
206 } 211 }
OLDNEW
« chrome/browser/gtk/gconf_titlebar_listener.h ('K') | « chrome/browser/upgrade_detector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698