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

Unified Diff: chrome/browser/extensions/extension_install_prompt.h

Issue 10388252: Refactoring ExtenionInstallUI to abstract the Browser references. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced + mac fix Created 8 years, 6 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
Index: chrome/browser/extensions/extension_install_prompt.h
diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_prompt.h
similarity index 79%
copy from chrome/browser/extensions/extension_install_ui.h
copy to chrome/browser/extensions/extension_install_prompt.h
index 1f46eec4627fceb99a061357cc7e7ad006e4078e..a77c2dcc09a27fa368e84c1d9c7042df6715bf17 100644
--- a/chrome/browser/extensions/extension_install_ui.h
+++ b/chrome/browser/extensions/extension_install_prompt.h
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
#pragma once
#include <string>
#include <vector>
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/common/extensions/url_pattern.h"
@@ -18,17 +19,15 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/native_widget_types.h"
-class Browser;
+class ExtensionInstallUI;
class ExtensionPermissionSet;
class MessageLoop;
class Profile;
class InfoBarDelegate;
-class TabContents;
-typedef TabContents TabContentsWrapper;
namespace base {
class DictionaryValue;
-}
+} // namespace base
namespace extensions {
class BundleInstaller;
@@ -37,7 +36,7 @@ class ExtensionWebstorePrivateApiTest;
} // namespace extensions
// Displays all the UI around extension installation.
-class ExtensionInstallUI : public ImageLoadingTracker::Observer {
+class ExtensionInstallPrompt : public ImageLoadingTracker::Observer {
public:
enum PromptType {
UNSET_PROMPT_TYPE = -1,
@@ -150,21 +149,10 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
const std::string& localized_description,
std::string* error);
- explicit ExtensionInstallUI(Profile* profile);
- virtual ~ExtensionInstallUI();
+ explicit ExtensionInstallPrompt(Profile* profile);
+ virtual ~ExtensionInstallPrompt();
- // TODO(asargent) Normally we navigate to the new tab page when an app is
- // installed, but we're experimenting with instead showing a bubble when
- // an app is installed which points to the new tab button. This may become
- // the default behavior in the future.
- void set_use_app_installed_bubble(bool use_bubble) {
- use_app_installed_bubble_ = use_bubble;
- }
-
- // Whether or not to show the default UI after completing the installation.
- void set_skip_post_install_ui(bool skip_ui) {
- skip_post_install_ui_ = skip_ui;
- }
+ ExtensionInstallUI* install_ui() const { return install_ui_.get(); }
// This is called by the bundle installer to verify whether the bundle
// should be installed.
@@ -224,27 +212,13 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
const std::string& extension_id,
int index) OVERRIDE;
- // Opens apps UI and animates the app icon for the app with id |app_id|.
- static void OpenAppInstalledUI(Browser* browser, const std::string& app_id);
-
protected:
friend class extensions::ExtensionWebstorePrivateApiTest;
friend class WebstoreInlineInstallUnpackFailureTest;
- // Disables showing UI (ErrorBox, etc.) for install failures. To be used only
- // in tests.
- static void DisableFailureUIForTests();
-
private:
friend class GalleryInstallApiTestObserver;
- // Show an infobar for a newly-installed theme. previous_theme_id
- // should be empty if the previous theme was the system/default
- // theme.
- static void ShowThemeInfoBar(
- const std::string& previous_theme_id, bool previous_using_native_theme,
- const extensions::Extension* new_theme, Profile* profile);
-
// Sets the icon that will be used in any UI. If |icon| is NULL, or contains
// an empty bitmap, then a default icon will be used instead.
void SetIcon(const SkBitmap* icon);
@@ -257,21 +231,9 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
// Shows the actual UI (the icon should already be loaded).
void ShowConfirmation();
- // Returns the delegate to control the browser's info bar. This is
- // within its own function due to its platform-specific nature.
- static InfoBarDelegate* GetNewThemeInstalledInfoBarDelegate(
- TabContentsWrapper* tab_contents,
- const extensions::Extension* new_theme,
- const std::string& previous_theme_id,
- bool previous_using_native_theme);
-
Profile* profile_;
MessageLoop* ui_loop_;
- // Used to undo theme installation.
- std::string previous_theme_id_;
- bool previous_using_native_theme_;
-
// The extensions installation icon.
SkBitmap icon_;
@@ -284,6 +246,9 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
// The permissions being prompted for.
scoped_refptr<const ExtensionPermissionSet> permissions_;
+ // The object responsible for doing the UI specific actions.
+ scoped_ptr<ExtensionInstallUI> install_ui_;
+
// The delegate we will call Proceed/Abort on after confirmation UI.
Delegate* delegate_;
@@ -296,13 +261,6 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
// Keeps track of extension images being loaded on the File thread for the
// purpose of showing the install UI.
ImageLoadingTracker tracker_;
-
- // Whether to show an installed bubble on app install, or use the default
- // action of opening a new tab page.
- bool use_app_installed_bubble_;
-
- // Whether or not to show the default UI after completing the installation.
- bool skip_post_install_ui_;
};
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
« no previous file with comments | « chrome/browser/extensions/extension_install_dialog.cc ('k') | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698