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

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

Issue 10010038: Do not show the install prompt for themes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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) 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 #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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/extensions/image_loading_tracker.h" 14 #include "chrome/browser/extensions/image_loading_tracker.h"
15 #include "chrome/common/extensions/url_pattern.h" 15 #include "chrome/common/extensions/url_pattern.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 class Browser; 20 class Browser;
21 class Extension; 21 class Extension;
22 class ExtensionPermissionSet; 22 class ExtensionPermissionSet;
23 class MessageLoop; 23 class MessageLoop;
24 class Profile; 24 class Profile;
25 class InfoBarDelegate; 25 class InfoBarDelegate;
26 class TabContentsWrapper; 26 class TabContentsWrapper;
27 27
28 namespace base {
29 class DictionaryValue;
30 } // namespace base
31
28 namespace extensions { 32 namespace extensions {
29 class BundleInstaller; 33 class BundleInstaller;
30 } // namespace extensions 34 } // namespace extensions
31 35
32 // Displays all the UI around extension installation. 36 // Displays all the UI around extension installation.
33 class ExtensionInstallUI : public ImageLoadingTracker::Observer { 37 class ExtensionInstallUI : public ImageLoadingTracker::Observer {
34 public: 38 public:
35 enum PromptType { 39 enum PromptType {
36 UNSET_PROMPT_TYPE = -1, 40 UNSET_PROMPT_TYPE = -1,
37 INSTALL_PROMPT = 0, 41 INSTALL_PROMPT = 0,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 virtual void InstallUIProceed() = 0; 128 virtual void InstallUIProceed() = 0;
125 129
126 // We call this method to signal that the installation should stop, with 130 // We call this method to signal that the installation should stop, with
127 // |user_initiated| true if the installation was stopped by the user. 131 // |user_initiated| true if the installation was stopped by the user.
128 virtual void InstallUIAbort(bool user_initiated) = 0; 132 virtual void InstallUIAbort(bool user_initiated) = 0;
129 133
130 protected: 134 protected:
131 virtual ~Delegate() {} 135 virtual ~Delegate() {}
132 }; 136 };
133 137
138 // Creates a dummy extension from the |manifest|, replacing the name and
139 // description with the localizations if provided.
140 static scoped_refptr<Extension> LocalizeExtensionForDisplay(
Yoyo Zhou 2012/04/20 15:38:14 I think GetLocalizedExtensionForDisplay would be c
jstritar 2012/04/20 16:18:27 Done.
141 const base::DictionaryValue* manifest,
142 const std::string& id,
143 const std::string& localized_name,
144 const std::string& localized_description,
145 std::string* error);
146
134 explicit ExtensionInstallUI(Profile* profile); 147 explicit ExtensionInstallUI(Profile* profile);
135 virtual ~ExtensionInstallUI(); 148 virtual ~ExtensionInstallUI();
136 149
137 // TODO(asargent) Normally we navigate to the new tab page when an app is 150 // TODO(asargent) Normally we navigate to the new tab page when an app is
138 // installed, but we're experimenting with instead showing a bubble when 151 // installed, but we're experimenting with instead showing a bubble when
139 // an app is installed which points to the new tab button. This may become 152 // an app is installed which points to the new tab button. This may become
140 // the default behavior in the future. 153 // the default behavior in the future.
141 void set_use_app_installed_bubble(bool use_bubble) { 154 void set_use_app_installed_bubble(bool use_bubble) {
142 use_app_installed_bubble_ = use_bubble; 155 use_app_installed_bubble_ = use_bubble;
143 } 156 }
144 157
145 // Whether or not to show the default UI after completing the installation. 158 // Whether or not to show the default UI after completing the installation.
146 void set_skip_post_install_ui(bool skip_ui) { 159 void set_skip_post_install_ui(bool skip_ui) {
147 skip_post_install_ui_ = skip_ui; 160 skip_post_install_ui_ = skip_ui;
148 } 161 }
149 162
163 // This is called by the bundle installer to verify whether the bundle
164 // should be installed.
165 //
166 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
167 virtual void ConfirmBundleInstall(extensions::BundleInstaller* bundle,
168 const ExtensionPermissionSet* permissions);
169
170 // This is called by the inline installer to verify whether the inline
171 // install from the webstore should proceed.
172 //
173 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
174 virtual void ConfirmInlineInstall(Delegate* delegate,
175 const Extension* extension,
176 SkBitmap* icon,
177 Prompt prompt);
178
179 // This is called by the installer to verify whether the installation from
180 // the webstore should proceed.
181 //
182 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
183 virtual void ConfirmWebstoreInstall(Delegate* delegate,
184 const Extension* extension,
185 const SkBitmap* icon);
186
150 // This is called by the installer to verify whether the installation should 187 // This is called by the installer to verify whether the installation should
151 // proceed. This is declared virtual for testing. 188 // proceed. This is declared virtual for testing.
152 // 189 //
153 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. 190 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
154 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); 191 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension);
155 192
156 // This is called by the app handler launcher to verify whether the app 193 // This is called by the app handler launcher to verify whether the app
157 // should be re-enabled. This is declared virtual for testing. 194 // should be re-enabled. This is declared virtual for testing.
158 // 195 //
159 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. 196 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 238
202 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains 239 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
203 // an empty bitmap, then a default icon will be used instead. 240 // an empty bitmap, then a default icon will be used instead.
204 void SetIcon(const SkBitmap* icon); 241 void SetIcon(const SkBitmap* icon);
205 242
206 // Starts the process of showing a confirmation UI, which is split into two. 243 // Starts the process of showing a confirmation UI, which is split into two.
207 // 1) Set off a 'load icon' task. 244 // 1) Set off a 'load icon' task.
208 // 2) Handle the load icon response and show the UI (OnImageLoaded). 245 // 2) Handle the load icon response and show the UI (OnImageLoaded).
209 void ShowConfirmation(PromptType prompt_type); 246 void ShowConfirmation(PromptType prompt_type);
210 247
248 // Shows the actual UI (the icon should already be loaded).
249 void ShowDialog();
250
211 // Returns the delegate to control the browser's info bar. This is 251 // Returns the delegate to control the browser's info bar. This is
212 // within its own function due to its platform-specific nature. 252 // within its own function due to its platform-specific nature.
213 static InfoBarDelegate* GetNewThemeInstalledInfoBarDelegate( 253 static InfoBarDelegate* GetNewThemeInstalledInfoBarDelegate(
214 TabContentsWrapper* tab_contents, 254 TabContentsWrapper* tab_contents,
215 const Extension* new_theme, 255 const Extension* new_theme,
216 const std::string& previous_theme_id, 256 const std::string& previous_theme_id,
217 bool previous_using_native_theme); 257 bool previous_using_native_theme);
218 258
219 Profile* profile_; 259 Profile* profile_;
220 MessageLoop* ui_loop_; 260 MessageLoop* ui_loop_;
221 261
222 // Used to undo theme installation. 262 // Used to undo theme installation.
223 std::string previous_theme_id_; 263 std::string previous_theme_id_;
224 bool previous_using_native_theme_; 264 bool previous_using_native_theme_;
225 265
226 // The extensions installation icon. 266 // The extensions installation icon.
227 SkBitmap icon_; 267 SkBitmap icon_;
228 268
229 // The extension we are showing the UI for. 269 // The extension we are showing the UI for.
230 const Extension* extension_; 270 const Extension* extension_;
231 271
272 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT.
273 const extensions::BundleInstaller* bundle_;
274
232 // The permissions being prompted for. 275 // The permissions being prompted for.
233 scoped_refptr<const ExtensionPermissionSet> permissions_; 276 scoped_refptr<const ExtensionPermissionSet> permissions_;
234 277
235 // The delegate we will call Proceed/Abort on after confirmation UI. 278 // The delegate we will call Proceed/Abort on after confirmation UI.
236 Delegate* delegate_; 279 Delegate* delegate_;
237 280
281 // A pre-filled prompt.
282 Prompt prompt_;
Yoyo Zhou 2012/04/20 15:38:14 It seems like if this is sometimes present and som
jstritar 2012/04/20 16:18:27 I'd rather avoid managing the Prompt's life-cycle.
Yoyo Zhou 2012/04/20 17:19:12 Seems fine to me -- I mean, we were copying Prompt
283
238 // The type of prompt we are going to show. 284 // The type of prompt we are going to show.
239 PromptType prompt_type_; 285 PromptType prompt_type_;
240 286
241 // Keeps track of extension images being loaded on the File thread for the 287 // Keeps track of extension images being loaded on the File thread for the
242 // purpose of showing the install UI. 288 // purpose of showing the install UI.
243 ImageLoadingTracker tracker_; 289 ImageLoadingTracker tracker_;
244 290
245 // Whether to show an installed bubble on app install, or use the default 291 // Whether to show an installed bubble on app install, or use the default
246 // action of opening a new tab page. 292 // action of opening a new tab page.
247 bool use_app_installed_bubble_; 293 bool use_app_installed_bubble_;
248 294
249 // Whether or not to show the default UI after completing the installation. 295 // Whether or not to show the default UI after completing the installation.
250 bool skip_post_install_ui_; 296 bool skip_post_install_ui_;
251 }; 297 };
252 298
253 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ 299 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698