| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/extensions/extension_disabled_ui.h" | 5 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 6 | 6 |
| 7 #include <bitset> | 7 #include <bitset> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 : public ExtensionInstallPrompt::Delegate, | 89 : public ExtensionInstallPrompt::Delegate, |
| 90 public base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate> { | 90 public base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate> { |
| 91 public: | 91 public: |
| 92 ExtensionDisabledDialogDelegate(ExtensionService* service, | 92 ExtensionDisabledDialogDelegate(ExtensionService* service, |
| 93 scoped_ptr<ExtensionInstallPrompt> install_ui, | 93 scoped_ptr<ExtensionInstallPrompt> install_ui, |
| 94 const Extension* extension); | 94 const Extension* extension); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 friend class base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate>; | 97 friend class base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate>; |
| 98 | 98 |
| 99 virtual ~ExtensionDisabledDialogDelegate(); | 99 ~ExtensionDisabledDialogDelegate() override; |
| 100 | 100 |
| 101 // ExtensionInstallPrompt::Delegate: | 101 // ExtensionInstallPrompt::Delegate: |
| 102 virtual void InstallUIProceed() override; | 102 void InstallUIProceed() override; |
| 103 virtual void InstallUIAbort(bool user_initiated) override; | 103 void InstallUIAbort(bool user_initiated) override; |
| 104 | 104 |
| 105 // The UI for showing the install dialog when enabling. | 105 // The UI for showing the install dialog when enabling. |
| 106 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 106 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
| 107 | 107 |
| 108 ExtensionService* service_; | 108 ExtensionService* service_; |
| 109 const Extension* extension_; | 109 const Extension* extension_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 ExtensionDisabledDialogDelegate::ExtensionDisabledDialogDelegate( | 112 ExtensionDisabledDialogDelegate::ExtensionDisabledDialogDelegate( |
| 113 ExtensionService* service, | 113 ExtensionService* service, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 143 | 143 |
| 144 class ExtensionDisabledGlobalError | 144 class ExtensionDisabledGlobalError |
| 145 : public GlobalErrorWithStandardBubble, | 145 : public GlobalErrorWithStandardBubble, |
| 146 public content::NotificationObserver, | 146 public content::NotificationObserver, |
| 147 public extensions::ExtensionUninstallDialog::Delegate { | 147 public extensions::ExtensionUninstallDialog::Delegate { |
| 148 public: | 148 public: |
| 149 ExtensionDisabledGlobalError(ExtensionService* service, | 149 ExtensionDisabledGlobalError(ExtensionService* service, |
| 150 const Extension* extension, | 150 const Extension* extension, |
| 151 bool is_remote_install, | 151 bool is_remote_install, |
| 152 const gfx::Image& icon); | 152 const gfx::Image& icon); |
| 153 virtual ~ExtensionDisabledGlobalError(); | 153 ~ExtensionDisabledGlobalError() override; |
| 154 | 154 |
| 155 // GlobalError implementation. | 155 // GlobalError implementation. |
| 156 virtual Severity GetSeverity() override; | 156 Severity GetSeverity() override; |
| 157 virtual bool HasMenuItem() override; | 157 bool HasMenuItem() override; |
| 158 virtual int MenuItemCommandID() override; | 158 int MenuItemCommandID() override; |
| 159 virtual base::string16 MenuItemLabel() override; | 159 base::string16 MenuItemLabel() override; |
| 160 virtual void ExecuteMenuItem(Browser* browser) override; | 160 void ExecuteMenuItem(Browser* browser) override; |
| 161 virtual gfx::Image GetBubbleViewIcon() override; | 161 gfx::Image GetBubbleViewIcon() override; |
| 162 virtual base::string16 GetBubbleViewTitle() override; | 162 base::string16 GetBubbleViewTitle() override; |
| 163 virtual std::vector<base::string16> GetBubbleViewMessages() override; | 163 std::vector<base::string16> GetBubbleViewMessages() override; |
| 164 virtual base::string16 GetBubbleViewAcceptButtonLabel() override; | 164 base::string16 GetBubbleViewAcceptButtonLabel() override; |
| 165 virtual base::string16 GetBubbleViewCancelButtonLabel() override; | 165 base::string16 GetBubbleViewCancelButtonLabel() override; |
| 166 virtual void OnBubbleViewDidClose(Browser* browser) override; | 166 void OnBubbleViewDidClose(Browser* browser) override; |
| 167 virtual void BubbleViewAcceptButtonPressed(Browser* browser) override; | 167 void BubbleViewAcceptButtonPressed(Browser* browser) override; |
| 168 virtual void BubbleViewCancelButtonPressed(Browser* browser) override; | 168 void BubbleViewCancelButtonPressed(Browser* browser) override; |
| 169 virtual bool ShouldCloseOnDeactivate() const override; | 169 bool ShouldCloseOnDeactivate() const override; |
| 170 | 170 |
| 171 // ExtensionUninstallDialog::Delegate implementation. | 171 // ExtensionUninstallDialog::Delegate implementation. |
| 172 virtual void ExtensionUninstallAccepted() override; | 172 void ExtensionUninstallAccepted() override; |
| 173 virtual void ExtensionUninstallCanceled() override; | 173 void ExtensionUninstallCanceled() override; |
| 174 | 174 |
| 175 // content::NotificationObserver implementation. | 175 // content::NotificationObserver implementation. |
| 176 virtual void Observe(int type, | 176 void Observe(int type, |
| 177 const content::NotificationSource& source, | 177 const content::NotificationSource& source, |
| 178 const content::NotificationDetails& details) override; | 178 const content::NotificationDetails& details) override; |
| 179 | 179 |
| 180 private: | 180 private: |
| 181 ExtensionService* service_; | 181 ExtensionService* service_; |
| 182 const Extension* extension_; | 182 const Extension* extension_; |
| 183 bool is_remote_install_; | 183 bool is_remote_install_; |
| 184 gfx::Image icon_; | 184 gfx::Image icon_; |
| 185 | 185 |
| 186 // How the user responded to the error; used for metrics. | 186 // How the user responded to the error; used for metrics. |
| 187 enum UserResponse { | 187 enum UserResponse { |
| 188 IGNORED, | 188 IGNORED, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 void ShowExtensionDisabledDialog(ExtensionService* service, | 437 void ShowExtensionDisabledDialog(ExtensionService* service, |
| 438 content::WebContents* web_contents, | 438 content::WebContents* web_contents, |
| 439 const Extension* extension) { | 439 const Extension* extension) { |
| 440 scoped_ptr<ExtensionInstallPrompt> install_ui( | 440 scoped_ptr<ExtensionInstallPrompt> install_ui( |
| 441 new ExtensionInstallPrompt(web_contents)); | 441 new ExtensionInstallPrompt(web_contents)); |
| 442 // This object manages its own lifetime. | 442 // This object manages its own lifetime. |
| 443 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 443 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace extensions | 446 } // namespace extensions |
| OLD | NEW |