| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "chrome/browser/plugin_installer_observer.h" |
| 10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
| 11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 12 | 13 |
| 13 // The main purpose for this class is to popup/close the infobar when there is | 14 // The main purpose for this class is to popup/close the infobar when there is |
| 14 // a missing plugin. | 15 // a missing plugin. |
| 15 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate { | 16 class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate, |
| 17 public PluginInstallerObserver { |
| 16 public: | 18 public: |
| 17 // Shows an infobar asking whether to install the plugin with the name | 19 // Shows an infobar asking whether to install the plugin with the name |
| 18 // |plugin_name|. When the user accepts, |callback| is called. | 20 // |plugin_name|. When the user accepts, |callback| is called. |
| 19 PluginInstallerInfoBarDelegate(InfoBarTabHelper* infobar_helper, | 21 // If |installer| is not NULL, registers itself as its observer. |
| 22 PluginInstallerInfoBarDelegate(PluginInstaller* installer, |
| 23 InfoBarTabHelper* infobar_helper, |
| 20 const string16& plugin_name, | 24 const string16& plugin_name, |
| 21 const GURL& learn_more_url, | 25 const GURL& learn_more_url, |
| 22 const base::Closure& callback); | 26 const base::Closure& callback); |
| 23 | 27 |
| 24 private: | 28 private: |
| 25 virtual ~PluginInstallerInfoBarDelegate(); | 29 virtual ~PluginInstallerInfoBarDelegate(); |
| 26 | 30 |
| 27 // ConfirmInfoBarDelegate: | 31 // ConfirmInfoBarDelegate: |
| 28 virtual gfx::Image* GetIcon() const OVERRIDE; | 32 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 29 virtual PluginInstallerInfoBarDelegate* | 33 virtual PluginInstallerInfoBarDelegate* |
| 30 AsPluginInstallerInfoBarDelegate() OVERRIDE; | 34 AsPluginInstallerInfoBarDelegate() OVERRIDE; |
| 31 virtual string16 GetMessageText() const OVERRIDE; | 35 virtual string16 GetMessageText() const OVERRIDE; |
| 32 virtual int GetButtons() const OVERRIDE; | 36 virtual int GetButtons() const OVERRIDE; |
| 33 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 37 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 34 virtual bool Accept() OVERRIDE; | 38 virtual bool Accept() OVERRIDE; |
| 35 virtual string16 GetLinkText() const OVERRIDE; | 39 virtual string16 GetLinkText() const OVERRIDE; |
| 36 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 40 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 37 | 41 |
| 42 // PluginInstallerObserver: |
| 43 virtual void DidStartDownload() OVERRIDE; |
| 44 |
| 38 string16 plugin_name_; | 45 string16 plugin_name_; |
| 39 GURL learn_more_url_; | 46 GURL learn_more_url_; |
| 40 base::Closure callback_; | 47 base::Closure callback_; |
| 41 | 48 |
| 42 DISALLOW_COPY_AND_ASSIGN(PluginInstallerInfoBarDelegate); | 49 DISALLOW_COPY_AND_ASSIGN(PluginInstallerInfoBarDelegate); |
| 43 }; | 50 }; |
| 44 | 51 |
| 45 #endif // CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ | 52 #endif // CHROME_BROWSER_PLUGIN_INSTALLER_INFOBAR_DELEGATE_H_ |
| OLD | NEW |