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

Side by Side Diff: chrome/browser/extensions/extension_install_ui.h

Issue 1075006: Eliminate all UI thread decoding of extension images.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
7 7
8 #include <string>
9
8 #include "base/file_path.h" 10 #include "base/file_path.h"
9 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/extensions/image_loading_tracker.h"
11 #include "gfx/native_widget_types.h" 14 #include "gfx/native_widget_types.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
13 16
14 #include <string>
15
16 class Extension; 17 class Extension;
17 class ExtensionsService; 18 class ExtensionsService;
18 class MessageLoop; 19 class MessageLoop;
19 class Profile; 20 class Profile;
20 class InfoBarDelegate; 21 class InfoBarDelegate;
21 class SandboxedExtensionUnpacker; 22 class SandboxedExtensionUnpacker;
22 class TabContents; 23 class TabContents;
23 24
24 // Displays all the UI around extension installation and uninstallation. 25 // Displays all the UI around extension installation and uninstallation.
25 class ExtensionInstallUI { 26 class ExtensionInstallUI : public ImageLoadingTracker::Observer {
26 public: 27 public:
27 enum PromptType { 28 enum PromptType {
28 INSTALL_PROMPT = 0, 29 INSTALL_PROMPT = 0,
29 UNINSTALL_PROMPT, 30 UNINSTALL_PROMPT,
30 ENABLE_INCOGNITO_PROMPT, 31 ENABLE_INCOGNITO_PROMPT,
31 NUM_PROMPT_TYPES 32 NUM_PROMPT_TYPES
32 }; 33 };
33 34
34 // A mapping from PromptType to message ID for various dialog content. 35 // A mapping from PromptType to message ID for various dialog content.
35 static const int kTitleIds[NUM_PROMPT_TYPES]; 36 static const int kTitleIds[NUM_PROMPT_TYPES];
(...skipping 13 matching lines...) Expand all
49 50
50 explicit ExtensionInstallUI(Profile* profile); 51 explicit ExtensionInstallUI(Profile* profile);
51 52
52 virtual ~ExtensionInstallUI() {} 53 virtual ~ExtensionInstallUI() {}
53 54
54 // This is called by the installer to verify whether the installation should 55 // This is called by the installer to verify whether the installation should
55 // proceed. This is declared virtual for testing. 56 // proceed. This is declared virtual for testing.
56 // 57 //
57 // We *MUST* eventually call either Proceed() or Abort() 58 // We *MUST* eventually call either Proceed() or Abort()
58 // on |delegate|. 59 // on |delegate|.
59 virtual void ConfirmInstall(Delegate* delegate, Extension* extension, 60 virtual void ConfirmInstall(Delegate* delegate, Extension* extension);
60 SkBitmap* icon);
61 61
62 // This is called by the extensions management page to verify whether the 62 // This is called by the extensions management page to verify whether the
63 // uninstallation should proceed. This is declared virtual for testing. 63 // uninstallation should proceed. This is declared virtual for testing.
64 // 64 //
65 // We *MUST* eventually call either Proceed() or Abort() 65 // We *MUST* eventually call either Proceed() or Abort()
66 // on |delegate|. 66 // on |delegate|.
67 virtual void ConfirmUninstall(Delegate* delegate, Extension* extension, 67 virtual void ConfirmUninstall(Delegate* delegate, Extension* extension);
68 SkBitmap* icon);
69 68
70 // This is called by the extensions management page to verify whether the 69 // This is called by the extensions management page to verify whether the
71 // uninstallation should proceed. This is declared virtual for testing. 70 // uninstallation should proceed. This is declared virtual for testing.
72 // 71 //
73 // We *MUST* eventually call either Proceed() or Abort() 72 // We *MUST* eventually call either Proceed() or Abort()
74 // on |delegate|. 73 // on |delegate|.
75 virtual void ConfirmEnableIncognito(Delegate* delegate, Extension* extension, 74 virtual void ConfirmEnableIncognito(Delegate* delegate, Extension* extension);
76 SkBitmap* icon);
77 75
78 // Installation was successful. This is declared virtual for testing. 76 // Installation was successful. This is declared virtual for testing.
79 virtual void OnInstallSuccess(Extension* extension); 77 virtual void OnInstallSuccess(Extension* extension);
80 78
81 // Installation failed. This is declared virtual for testing. 79 // Installation failed. This is declared virtual for testing.
82 virtual void OnInstallFailure(const std::string& error); 80 virtual void OnInstallFailure(const std::string& error);
83 81
84 // The install was rejected because the same extension/version is already 82 // The install was rejected because the same extension/version is already
85 // installed. This is declared virtual for testing. 83 // installed. This is declared virtual for testing.
86 virtual void OnOverinstallAttempted(Extension* extension); 84 virtual void OnOverinstallAttempted(Extension* extension);
87 85
86 // ImageLoadingTracker::Observer overrides.
87 virtual void OnImageLoaded(SkBitmap* image, int index);
88
88 private: 89 private:
89 // When a Theme is downloaded it is applied and an info bar is shown to give 90 // When a Theme is downloaded it is applied and an info bar is shown to give
90 // the user a choice to keep it or undo the installation. 91 // the user a choice to keep it or undo the installation.
91 void ShowThemeInfoBar(Extension* new_theme); 92 void ShowThemeInfoBar(Extension* new_theme);
92 93
93 #if defined(OS_MACOSX) 94 #if defined(OS_MACOSX)
94 // When an extension is installed on Mac with neither browser action nor 95 // When an extension is installed on Mac with neither browser action nor
95 // page action icons, show an infobar instead of a popup bubble. 96 // page action icons, show an infobar instead of a popup bubble.
96 void ShowGenericExtensionInstalledInfoBar(Extension* new_extension); 97 void ShowGenericExtensionInstalledInfoBar(Extension* new_extension);
97 #endif 98 #endif
98 99
99 // Returns the delegate to control the browser's info bar. This is within its 100 // Returns the delegate to control the browser's info bar. This is within its
100 // own function due to its platform-specific nature. 101 // own function due to its platform-specific nature.
101 InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme, 102 InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme,
102 TabContents* tab_contents); 103 TabContents* tab_contents);
103 104
104 // Implements the showing of the install/uninstall dialog prompt. 105 // Implements the showing of the install/uninstall dialog prompt.
105 // NOTE: The implementations of this function is platform-specific. 106 // NOTE: The implementations of this function is platform-specific.
106 static void ShowExtensionInstallUIPromptImpl( 107 static void ShowExtensionInstallUIPromptImpl(
107 Profile* profile, Delegate* delegate, Extension* extension, 108 Profile* profile, Delegate* delegate, Extension* extension,
108 SkBitmap* icon, const string16& warning_text, PromptType type); 109 SkBitmap* icon, const string16& warning_text, PromptType type);
109 110
110 Profile* profile_; 111 Profile* profile_;
111 MessageLoop* ui_loop_; 112 MessageLoop* ui_loop_;
112 std::string previous_theme_id_; // Used to undo theme installation. 113 std::string previous_theme_id_; // Used to undo theme installation.
113 SkBitmap icon_; // The extensions installation icon. 114 SkBitmap icon_; // The extensions installation icon.
115 Extension* extension_; // The extension we are showing the UI for.
116 Delegate* delegate_; // The delegate we will call Proceed/Abort on after
117 // confirmation UI.
118
119 // Keeps track of extension images being loaded on the File thread for the
120 // purpose of showing the install UI.
121 ImageLoadingTracker tracker_;
114 122
115 #if defined(TOOLKIT_GTK) 123 #if defined(TOOLKIT_GTK)
116 // Also needed to undo theme installation in the linux UI. 124 // Also needed to undo theme installation in the Linux UI.
117 bool previous_use_gtk_theme_; 125 bool previous_use_gtk_theme_;
118 #endif 126 #endif
119 }; 127 };
120 128
121 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ 129 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698