OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ |
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ | 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/automation/automation_resource_tracker.h" | 9 #include "chrome/browser/automation/automation_resource_tracker.h" |
10 | 10 |
11 class Extension; | 11 class Extension; |
12 | 12 |
13 // Tracks an Extension. An Extension is removed on uninstall, not on disable. | 13 // Tracks an Extension. An Extension is removed on uninstall, not on disable. |
14 class AutomationExtensionTracker | 14 class AutomationExtensionTracker |
15 : public AutomationResourceTracker<Extension*> { | 15 : public AutomationResourceTracker<Extension*> { |
16 public: | 16 public: |
17 explicit AutomationExtensionTracker(IPC::Message::Sender* automation); | 17 explicit AutomationExtensionTracker(IPC::Message::Sender* automation); |
18 | 18 |
19 virtual ~AutomationExtensionTracker(); | 19 virtual ~AutomationExtensionTracker(); |
20 | 20 |
21 // This is empty because we do not want to add an observer for every | 21 // This is empty because we do not want to add an observer for every |
22 // extension added to the tracker. This is because the profile, not the | 22 // extension added to the tracker. This is because the profile, not the |
23 // extension, is the one who sends the notification about extension | 23 // extension, is the one who sends the notification about extension |
24 // uninstalls. Instead of using this method, one observer is added for all | 24 // uninstalls. Instead of using this method, one observer is added for all |
25 // extensions in the constructor. | 25 // extensions in the constructor. |
26 virtual void AddObserver(Extension* resource) {} | 26 virtual void AddObserver(Extension* resource); |
27 | 27 |
28 // See related comment above as to why this method is empty. | 28 // See related comment above as to why this method is empty. |
29 virtual void RemoveObserver(Extension* resource) {} | 29 virtual void RemoveObserver(Extension* resource); |
30 | 30 |
31 // Overriding AutomationResourceTracker Observe. AutomationResourceTracker's | 31 // Overriding AutomationResourceTracker Observe. AutomationResourceTracker's |
32 // Observe expects the NotificationSource to be the object that is closing. | 32 // Observe expects the NotificationSource to be the object that is closing. |
33 // This is not true for the relevant extension notifications, so we have to | 33 // This is not true for the relevant extension notifications, so we have to |
34 // the observation ourselves. | 34 // the observation ourselves. |
35 virtual void Observe(NotificationType type, | 35 virtual void Observe(NotificationType type, |
36 const NotificationSource& source, | 36 const NotificationSource& source, |
37 const NotificationDetails& details); | 37 const NotificationDetails& details); |
38 }; | 38 }; |
39 | 39 |
40 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ | 40 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_ |
OLD | NEW |