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

Side by Side Diff: chrome/browser/component_updater/pnacl/pnacl_updater_observer.cc

Issue 55463002: Remove PNaCl's RequestFirstInstall, use resource throttle instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reorder functions Created 7 years, 1 month 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h"
6
7 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
8 #include "content/public/browser/browser_thread.h"
9
10 using content::BrowserThread;
11
12 PnaclUpdaterObserver::PnaclUpdaterObserver(PnaclComponentInstaller* pci)
13 : must_observe_(false), pnacl_installer_(pci) {}
14
15 PnaclUpdaterObserver::~PnaclUpdaterObserver() {}
16
17 void PnaclUpdaterObserver::EnsureObserving() {
18 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
19 must_observe_ = true;
20 }
21
22 void PnaclUpdaterObserver::StopObserving() {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
24 must_observe_ = false;
25 }
26
27 void PnaclUpdaterObserver::OnEvent(Events event, int extra) {
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
29 if (must_observe_) {
30 switch (event) {
31 default:
32 break;
33 case COMPONENT_UPDATE_READY:
34 // If the component updater says there is an UPDATE_READY w/ source
35 // being the PNaCl ID, then installation is handed off to the PNaCl
36 // installer and we can stop observing. The installer will be the one
37 // to run the callback w/ success or failure.
38 must_observe_ = false;
39 break;
40 case COMPONENT_UPDATER_SLEEPING:
41 // If the component updater sleeps before an UPDATE_READY for this
42 // component, then requests for installs were likely skipped,
43 // an error occurred, or there was no new update.
44 must_observe_ = false;
45 pnacl_installer_->NotifyInstallError();
46 break;
47 }
48 }
49 }
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/pnacl/pnacl_updater_observer.h ('k') | chrome/browser/nacl_host/nacl_browser_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698