Home | History | Annotate | Download | only in plugins
      1 // Copyright (c) 2012 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_PLUGINS_PLUGIN_INSTALLER_OBSERVER_H_
      6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_OBSERVER_H_
      7 
      8 #include <string>
      9 
     10 class PluginInstaller;
     11 
     12 class PluginInstallerObserver {
     13  public:
     14   explicit PluginInstallerObserver(PluginInstaller* installer);
     15   virtual ~PluginInstallerObserver();
     16 
     17  protected:
     18   PluginInstaller* installer() const { return installer_; }
     19 
     20  private:
     21   friend class PluginInstaller;
     22 
     23   virtual void DownloadStarted();
     24   virtual void DownloadFinished();
     25   virtual void DownloadError(const std::string& message);
     26   virtual void DownloadCancelled();
     27 
     28   // Weak pointer; Owned by PluginFinder, which is a singleton.
     29   PluginInstaller* installer_;
     30 };
     31 
     32 // A WeakPluginInstallerObserver is like a weak pointer to the installer, in the
     33 // sense that if only weak observers are left, we don't need to show
     34 // installation UI anymore.
     35 class WeakPluginInstallerObserver : public PluginInstallerObserver {
     36  public:
     37   explicit WeakPluginInstallerObserver(PluginInstaller* installer);
     38   virtual ~WeakPluginInstallerObserver();
     39 
     40  private:
     41   friend class PluginInstaller;
     42 
     43   virtual void OnlyWeakObserversLeft();
     44 };
     45 
     46 #endif  // CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_OBSERVER_H_
     47