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

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

Issue 17001003: Replace early check for PNaCl with an on-demand check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: observer instead of timeout Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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/component_updater/pnacl/pnacl_profile_observer.h" 5 #include "chrome/browser/component_updater/pnacl/pnacl_updater_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" 8 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 11
12 PnaclProfileObserver::PnaclProfileObserver( 12 PnaclUpdaterObserver::PnaclUpdaterObserver(
13 PnaclComponentInstaller* installer) : pnacl_installer_(installer) { 13 PnaclComponentInstaller* installer) : pnacl_installer_(installer) {
14 // We only need to observe NOTIFICATION_LOGIN_USER_CHANGED for ChromeOS
15 // (and it's only defined for ChromeOS).
16 #if defined(OS_CHROMEOS)
17 registrar_.Add(this, 14 registrar_.Add(this,
18 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 15 chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING,
19 content::NotificationService::AllSources()); 16 content::NotificationService::AllSources());
20 #endif
21 } 17 }
22 18
23 PnaclProfileObserver::~PnaclProfileObserver() { } 19 PnaclUpdaterObserver::~PnaclUpdaterObserver() { }
24 20
25 void PnaclProfileObserver::Observe( 21 void PnaclUpdaterObserver::Observe(
26 int type, 22 int type,
27 const content::NotificationSource& source, 23 const content::NotificationSource& source,
28 const content::NotificationDetails& details) { 24 const content::NotificationDetails& details) {
29 #if defined(OS_CHROMEOS) 25 if (type == chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING) {
30 if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { 26 // If the component updater sleeps before a NotifyInstallSuccess,
cpu_(ooo_6.6-7.5) 2013/06/20 22:21:45 oh we better not break this pseudo contract. Let
jvoung (off chromium) 2013/06/20 22:55:19 One way could be to add a NOTIFICATION_COMPONENT_U
31 pnacl_installer_->ReRegisterPnacl(); 27 // then requests for installs were likely skipped, or an error occurred.
28 pnacl_installer_->NotifyInstallError();
32 return; 29 return;
33 } 30 }
34 NOTREACHED() << "Unexpected notification observed";
35 #endif
36 } 31 }
OLDNEW
« no previous file with comments | « chrome/browser/component_updater/pnacl/pnacl_updater_observer.h ('k') | chrome/browser/nacl_host/nacl_file_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698