summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_extension_tracker.h
blob: e55a2eb44d71955cdef9a87547cce0075c213709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_
#define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_

#include "chrome/browser/automation/automation_resource_tracker.h"

class Extension;

// Tracks an Extension. An Extension is removed on uninstall, not on disable.
class AutomationExtensionTracker
    : public AutomationResourceTracker<Extension*> {
 public:
  AutomationExtensionTracker(IPC::Message::Sender* automation);

  virtual ~AutomationExtensionTracker();

  // This is empty because we do not want to add an observer for every
  // extension added to the tracker. This is because the profile, not the
  // extension, is the one who sends the notification about extension
  // uninstalls. Instead of using this method, one observer is added for all
  // extensions in the constructor.
  virtual void AddObserver(Extension* resource) {}

  // See related comment above as to why this method is empty.
  virtual void RemoveObserver(Extension* resource) {}

  // Overriding AutomationResourceTracker Observe. AutomationResourceTracker's
  // Observe expects the NotificationSource to be the object that is closing.
  // This is not true for the relevant extension notifications, so we have to
  // the observation ourselves.
  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details);
};

#endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_