OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_ |
| 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 13 |
| 14 class ExtensionEnableFlowDelegate; |
| 15 |
| 16 // ExtensionEnableFlow performs an UI flow to enable a disabled/terminated |
| 17 // extension. It calls its delegate when enabling is done or is aborted. |
| 18 // Callback on the delegate might be called synchronously if there is no |
| 19 // permission change while the extension is disabled/terminated (or the |
| 20 // extension is enabled already). Otherwise, a re-enable install prompt is |
| 21 // shown to user. The extension is enabled when user acknowledges it or the |
| 22 // flow is aborted when user declines it. |
| 23 class ExtensionEnableFlow : public ExtensionInstallPrompt::Delegate { |
| 24 public: |
| 25 ExtensionEnableFlow(Profile* profile, |
| 26 const std::string& extension_id, |
| 27 ExtensionEnableFlowDelegate* delegate); |
| 28 virtual ~ExtensionEnableFlow(); |
| 29 |
| 30 // Starts the flow and the logic continues on |delegate_| after enabling is |
| 31 // finished or aborted. |
| 32 void Start(); |
| 33 |
| 34 const std::string& extension_id() const { return extension_id_; } |
| 35 |
| 36 private: |
| 37 // ExtensionInstallPrompt::Delegate overrides: |
| 38 virtual void InstallUIProceed() OVERRIDE; |
| 39 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
| 40 |
| 41 Profile* const profile_; |
| 42 const std::string extension_id_; |
| 43 ExtensionEnableFlowDelegate* const delegate_; // Not owned. |
| 44 |
| 45 scoped_ptr<ExtensionInstallPrompt> prompt_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(ExtensionEnableFlow); |
| 48 }; |
| 49 |
| 50 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_ |
OLD | NEW |