Home | History | Annotate | Download | only in automation
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_
      6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_
      7 #pragma once
      8 
      9 #include "chrome/browser/automation/automation_resource_tracker.h"
     10 
     11 class Extension;
     12 
     13 // Tracks an Extension. An Extension is removed on uninstall, not on disable.
     14 class AutomationExtensionTracker
     15     : public AutomationResourceTracker<const Extension*> {
     16  public:
     17   explicit AutomationExtensionTracker(IPC::Message::Sender* automation);
     18 
     19   virtual ~AutomationExtensionTracker();
     20 
     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
     23   // extension, is the one who sends the notification about extension
     24   // uninstalls. Instead of using this method, one observer is added for all
     25   // extensions in the constructor.
     26   virtual void AddObserver(const Extension* resource);
     27 
     28   // See related comment above as to why this method is empty.
     29   virtual void RemoveObserver(const Extension* resource);
     30 
     31   // Overriding AutomationResourceTracker Observe. AutomationResourceTracker's
     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
     34   // the observation ourselves.
     35   virtual void Observe(NotificationType type,
     36                        const NotificationSource& source,
     37                        const NotificationDetails& details);
     38 };
     39 
     40 #endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_TRACKER_H_
     41