Fix build break
[chromium-blink-merge.git] / chrome / browser / plugins / plugin_installer.h
blob36b7eb3cb8b640e72e8a5816a63da55a96d65c83
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.
5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_
8 #include "base/observer_list.h"
9 #include "base/string16.h"
10 #include "base/version.h"
11 #include "chrome/browser/plugins/plugin_metadata.h"
12 #include "content/public/browser/download_item.h"
13 #include "googleurl/src/gurl.h"
14 #include "net/base/net_errors.h"
16 class PluginInstallerObserver;
17 class WeakPluginInstallerObserver;
19 namespace content {
20 class WebContents;
23 namespace webkit {
24 struct WebPluginInfo;
27 class PluginInstaller : public content::DownloadItem::Observer {
28 public:
29 enum InstallerState {
30 INSTALLER_STATE_IDLE,
31 INSTALLER_STATE_DOWNLOADING,
34 PluginInstaller();
35 virtual ~PluginInstaller();
37 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
38 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
40 void AddObserver(PluginInstallerObserver* observer);
41 void RemoveObserver(PluginInstallerObserver* observer);
43 void AddWeakObserver(WeakPluginInstallerObserver* observer);
44 void RemoveWeakObserver(WeakPluginInstallerObserver* observer);
46 InstallerState state() const { return state_; }
48 // Opens the download URL in a new tab.
49 void OpenDownloadURL(const GURL& plugin_url,
50 content::WebContents* web_contents);
52 // Starts downloading the download URL and opens the downloaded file
53 // when finished.
54 void StartInstalling(const GURL& plugin_url,
55 content::WebContents* web_contents);
57 private:
58 void DownloadStarted(scoped_refptr<content::DownloadManager> dlm,
59 content::DownloadItem* item,
60 net::Error error);
61 void DownloadError(const std::string& msg);
62 void DownloadCancelled();
64 InstallerState state_;
65 ObserverList<PluginInstallerObserver> observers_;
66 ObserverList<WeakPluginInstallerObserver> weak_observers_;
68 DISALLOW_COPY_AND_ASSIGN(PluginInstaller);
71 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INSTALLER_H_