Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(919)

Unified Diff: chrome/browser/ui/extensions/extension_enable_flow.h

Issue 11644077: Put extension enable logic into a ExtensionEnableFlow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + address comments in #1 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/extension_enable_flow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/extension_enable_flow.h
diff --git a/chrome/browser/ui/extensions/extension_enable_flow.h b/chrome/browser/ui/extensions/extension_enable_flow.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d2d456833ed28c118b14bae91fd4fd0fd1d597c
--- /dev/null
+++ b/chrome/browser/ui/extensions/extension_enable_flow.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_
+#define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/extensions/extension_install_prompt.h"
+
+class ExtensionEnableFlowDelegate;
+
+// ExtensionEnableFlow performs an UI flow to enable a disabled/terminated
+// extension. It calls its delegate when enabling is done or is aborted.
+// Callback on the delegate might be called synchronously if there is no
+// permission change while the extension is disabled/terminated (or the
+// extension is enabled already). Otherwise, a re-enable install prompt is
+// shown to user. The extension is enabled when user acknowledges it or the
+// flow is aborted when user declines it.
+class ExtensionEnableFlow : public ExtensionInstallPrompt::Delegate {
+ public:
+ ExtensionEnableFlow(Profile* profile,
+ const std::string& extension_id,
+ ExtensionEnableFlowDelegate* delegate);
+ virtual ~ExtensionEnableFlow();
+
+ // Starts the flow and the logic continues on |delegate_| after enabling is
+ // finished or aborted.
+ void Start();
+
+ const std::string& extension_id() const { return extension_id_; }
+
+ private:
+ // ExtensionInstallPrompt::Delegate overrides:
+ virtual void InstallUIProceed() OVERRIDE;
+ virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
+
+ Profile* const profile_;
+ const std::string extension_id_;
+ ExtensionEnableFlowDelegate* const delegate_; // Not owned.
+
+ scoped_ptr<ExtensionInstallPrompt> prompt_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionEnableFlow);
+};
+
+#endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_H_
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/extension_enable_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698