OLD | NEW |
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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "chrome/browser/component_updater/component_updater_service.h" |
10 #include "content/public/browser/notification_registrar.h" | |
11 | 10 |
12 class PnaclComponentInstaller; | 11 class PnaclComponentInstaller; |
13 | 12 |
14 // Monitors the component updater service, so that the callbacks registered | 13 // Monitors the component updater service, so that the callbacks registered |
15 // against the PnaclComponentInstaller can be notified of events. | 14 // against the PnaclComponentInstaller can be notified of events. |
16 class PnaclUpdaterObserver : public content::NotificationObserver { | 15 class PnaclUpdaterObserver : public ComponentObserver { |
17 public: | 16 public: |
18 explicit PnaclUpdaterObserver(PnaclComponentInstaller* installer); | 17 explicit PnaclUpdaterObserver(PnaclComponentInstaller* pci); |
19 virtual ~PnaclUpdaterObserver(); | 18 virtual ~PnaclUpdaterObserver(); |
20 | 19 |
21 virtual void Observe( | 20 virtual void OnEvent(Events event, int extra) OVERRIDE; |
22 int type, | 21 |
23 const content::NotificationSource& source, | 22 void EnsureObserving(); |
24 const content::NotificationDetails& details) OVERRIDE; | 23 void StopObserving(); |
25 | 24 |
26 private: | 25 private: |
27 content::NotificationRegistrar registrar_; | 26 bool must_observe_; |
28 PnaclComponentInstaller* pnacl_installer_; | 27 PnaclComponentInstaller* pnacl_installer_; |
29 DISALLOW_COPY_AND_ASSIGN(PnaclUpdaterObserver); | 28 DISALLOW_COPY_AND_ASSIGN(PnaclUpdaterObserver); |
30 }; | 29 }; |
31 | 30 |
32 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ | 31 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ |
OLD | NEW |