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 "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
11 | 11 |
12 class PnaclComponentInstaller; | 12 class PnaclComponentInstaller; |
13 | 13 |
14 // Monitors the component updater service, so that the callbacks registered | 14 // Monitors the component updater service, so that the callbacks registered |
15 // against the PnaclComponentInstaller can be notified of events. | 15 // against the PnaclComponentInstaller can be notified of events. |
16 class PnaclUpdaterObserver : public content::NotificationObserver { | 16 class PnaclUpdaterObserver : public content::NotificationObserver { |
17 public: | 17 public: |
18 explicit PnaclUpdaterObserver(PnaclComponentInstaller* installer); | 18 explicit PnaclUpdaterObserver(PnaclComponentInstaller* installer); |
19 virtual ~PnaclUpdaterObserver(); | 19 virtual ~PnaclUpdaterObserver(); |
20 | 20 |
21 virtual void Observe( | 21 // Make sure that this has registered to observe relevant notifications. |
22 int type, | 22 void EnsureObserving(); |
23 const content::NotificationSource& source, | 23 |
24 const content::NotificationDetails& details) OVERRIDE; | 24 // Unregister for observing notifcations. |
| 25 void StopObserving(); |
| 26 |
| 27 virtual void Observe(int type, |
| 28 const content::NotificationSource& source, |
| 29 const content::NotificationDetails& details) OVERRIDE; |
25 | 30 |
26 private: | 31 private: |
27 content::NotificationRegistrar registrar_; | 32 content::NotificationRegistrar registrar_; |
28 PnaclComponentInstaller* pnacl_installer_; | 33 PnaclComponentInstaller* pnacl_installer_; |
29 DISALLOW_COPY_AND_ASSIGN(PnaclUpdaterObserver); | 34 DISALLOW_COPY_AND_ASSIGN(PnaclUpdaterObserver); |
30 }; | 35 }; |
31 | 36 |
32 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ | 37 #endif // CHROME_BROWSER_COMPONENT_UPDATER_PNACL_PNACL_UPDATER_OBSERVER_H_ |
OLD | NEW |