BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / plugins / plugin_infobar_delegates.h
blobba1249a347583c389e1dacbd45269163b9d11160
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_INFOBAR_DELEGATES_H_
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_
8 #include "base/callback.h"
9 #include "components/infobars/core/confirm_infobar_delegate.h"
10 #include "url/gurl.h"
12 #if defined(ENABLE_PLUGIN_INSTALLATION)
13 #include "chrome/browser/plugins/plugin_installer_observer.h"
14 #endif
16 class InfoBarService;
17 class HostContentSettingsMap;
18 class PluginMetadata;
20 namespace content {
21 class WebContents;
24 // Base class for blocked plugin infobars.
25 class PluginInfoBarDelegate : public ConfirmInfoBarDelegate {
26 protected:
27 explicit PluginInfoBarDelegate(const std::string& identifier);
28 ~PluginInfoBarDelegate() override;
30 // ConfirmInfoBarDelegate:
31 bool LinkClicked(WindowOpenDisposition disposition) override;
33 virtual std::string GetLearnMoreURL() const = 0;
35 void LoadBlockedPlugins();
37 private:
38 // ConfirmInfoBarDelegate:
39 int GetIconId() const override;
40 base::string16 GetLinkText() const override;
42 std::string identifier_;
44 DISALLOW_COPY_AND_ASSIGN(PluginInfoBarDelegate);
47 #if defined(ENABLE_PLUGIN_INSTALLATION)
48 // Infobar that's shown when a plugin is out of date.
49 class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate,
50 public WeakPluginInstallerObserver {
51 public:
52 // Creates an outdated plugin infobar and delegate and adds the infobar to
53 // |infobar_service|.
54 static void Create(InfoBarService* infobar_service,
55 PluginInstaller* installer,
56 scoped_ptr<PluginMetadata> metadata);
58 // Replaces |infobar|, which must currently be owned, with an infobar asking
59 // the user to update a particular plugin.
60 static void Replace(infobars::InfoBar* infobar,
61 PluginInstaller* installer,
62 scoped_ptr<PluginMetadata> plugin_metadata,
63 const base::string16& message);
65 private:
66 OutdatedPluginInfoBarDelegate(PluginInstaller* installer,
67 scoped_ptr<PluginMetadata> metadata,
68 const base::string16& message);
69 ~OutdatedPluginInfoBarDelegate() override;
71 // PluginInfoBarDelegate:
72 void InfoBarDismissed() override;
73 base::string16 GetMessageText() const override;
74 base::string16 GetButtonLabel(InfoBarButton button) const override;
75 bool Accept() override;
76 bool Cancel() override;
77 bool LinkClicked(WindowOpenDisposition disposition) override;
78 std::string GetLearnMoreURL() const override;
80 // PluginInstallerObserver:
81 void DownloadStarted() override;
82 void DownloadError(const std::string& message) override;
83 void DownloadCancelled() override;
84 void DownloadFinished() override;
86 // WeakPluginInstallerObserver:
87 void OnlyWeakObserversLeft() override;
89 // Replaces this infobar with one showing |message|. The new infobar will
90 // not have any buttons (and not call the callback).
91 void ReplaceWithInfoBar(const base::string16& message);
93 scoped_ptr<PluginMetadata> plugin_metadata_;
95 base::string16 message_;
97 DISALLOW_COPY_AND_ASSIGN(OutdatedPluginInfoBarDelegate);
99 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
101 #if defined(OS_WIN)
102 class PluginMetroModeInfoBarDelegate : public ConfirmInfoBarDelegate {
103 public:
104 // The infobar can be used for two purposes: to inform the user about a
105 // missing plugin or to note that a plugin only works in desktop mode. These
106 // purposes require different messages, buttons, etc.
107 enum Mode {
108 MISSING_PLUGIN,
109 DESKTOP_MODE_REQUIRED,
112 // Creates a metro mode infobar and delegate and adds the infobar to
113 // |infobar_service|.
114 static void Create(InfoBarService* infobar_service,
115 Mode mode,
116 const base::string16& name);
118 private:
119 PluginMetroModeInfoBarDelegate(Mode mode, const base::string16& name);
120 ~PluginMetroModeInfoBarDelegate() override;
122 // ConfirmInfoBarDelegate:
123 int GetIconId() const override;
124 base::string16 GetMessageText() const override;
125 int GetButtons() const override;
126 base::string16 GetButtonLabel(InfoBarButton button) const override;
127 bool Accept() override;
128 base::string16 GetLinkText() const override;
129 bool LinkClicked(WindowOpenDisposition disposition) override;
131 const Mode mode_;
132 const base::string16 name_;
134 DISALLOW_COPY_AND_ASSIGN(PluginMetroModeInfoBarDelegate);
136 #endif // defined(OS_WIN)
138 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_INFOBAR_DELEGATES_H_