summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_installer_observer.h
blob: f1f28d02f29cea937bc6e015fc7eb6684cfdc7b6 (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
40
41
42
43
44
45
46
47
// Copyright (c) 2012 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_PLUGIN_INSTALLER_OBSERVER_H_
#define CHROME_BROWSER_PLUGIN_INSTALLER_OBSERVER_H_
#pragma once

#include <string>

class PluginInstaller;

class PluginInstallerObserver {
 public:
  explicit PluginInstallerObserver(PluginInstaller* installer);
  virtual ~PluginInstallerObserver();

 protected:
  PluginInstaller* installer() const { return installer_; }

 private:
  friend class PluginInstaller;

  virtual void DownloadStarted();
  virtual void DownloadFinished();
  virtual void DownloadError(const std::string& message);
  virtual void DownloadCancelled();

  // Weak pointer; Owned by PluginFinder, which is a singleton.
  PluginInstaller* installer_;
};

// A WeakPluginInstallerObserver is like a weak pointer to the installer, in the
// sense that if only weak observers are left, we don't need to show
// installation UI anymore.
class WeakPluginInstallerObserver : public PluginInstallerObserver {
 public:
  explicit WeakPluginInstallerObserver(PluginInstaller* installer);
  virtual ~WeakPluginInstallerObserver();

 private:
  friend class PluginInstaller;

  virtual void OnlyWeakObserversLeft();
};

#endif  // CHROME_BROWSER_PLUGIN_INSTALLER_OBSERVER_H_