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

Side by Side Diff: chrome/browser/chromeos/cros/update_library.cc

Issue 6966025: [ChromeOS] Move ChromeOS upgrade check logic into UpgradeDetector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/cros/update_library.h" 5 #include "chrome/browser/chromeos/cros/update_library.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "content/browser/browser_thread.h" 10 #include "content/browser/browser_thread.h"
11 #include "content/common/notification_service.h"
12 #include "content/common/notification_type.h"
13 11
14 namespace chromeos { 12 namespace chromeos {
15 13
16 class UpdateLibraryImpl : public UpdateLibrary { 14 class UpdateLibraryImpl : public UpdateLibrary {
17 public: 15 public:
18 UpdateLibraryImpl() 16 UpdateLibraryImpl()
19 : status_connection_(NULL) { 17 : status_connection_(NULL) {
20 if (CrosLibrary::Get()->EnsureLoaded()) { 18 if (CrosLibrary::Get()->EnsureLoaded()) {
21 Init(); 19 Init();
22 } 20 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Make sure we run on UI thread. 82 // Make sure we run on UI thread.
85 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 83 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
86 BrowserThread::PostTask( 84 BrowserThread::PostTask(
87 BrowserThread::UI, FROM_HERE, 85 BrowserThread::UI, FROM_HERE,
88 NewRunnableMethod(this, &UpdateLibraryImpl::UpdateStatus, status)); 86 NewRunnableMethod(this, &UpdateLibraryImpl::UpdateStatus, status));
89 return; 87 return;
90 } 88 }
91 89
92 status_ = status; 90 status_ = status;
93 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(this)); 91 FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(this));
94
95 // If the update is ready to install, send a notification so that Chrome
96 // can update the UI.
97 if (status_.status == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
98 NotificationService::current()->Notify(
99 NotificationType::UPGRADE_RECOMMENDED,
100 Source<UpdateLibrary>(this),
101 NotificationService::NoDetails());
102 }
103 } 92 }
104 93
105 ObserverList<Observer> observers_; 94 ObserverList<Observer> observers_;
106 95
107 // A reference to the update api, to allow callbacks when the update 96 // A reference to the update api, to allow callbacks when the update
108 // status changes. 97 // status changes.
109 UpdateStatusConnection status_connection_; 98 UpdateStatusConnection status_connection_;
110 99
111 // The latest power status. 100 // The latest power status.
112 Status status_; 101 Status status_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return new UpdateLibraryStubImpl(); 137 return new UpdateLibraryStubImpl();
149 else 138 else
150 return new UpdateLibraryImpl(); 139 return new UpdateLibraryImpl();
151 } 140 }
152 141
153 } // namespace chromeos 142 } // namespace chromeos
154 143
155 // Allows InvokeLater without adding refcounting. This class is a Singleton and 144 // Allows InvokeLater without adding refcounting. This class is a Singleton and
156 // won't be deleted until it's last InvokeLater is run. 145 // won't be deleted until it's last InvokeLater is run.
157 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::UpdateLibraryImpl); 146 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::UpdateLibraryImpl);
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | chrome/browser/upgrade_detector.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698