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

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 557953005: Allow the user to "repair" a corrupted extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest Master Created 6 years, 3 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
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 #include "chrome/browser/extensions/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
46 #include "ui/gfx/image/image.h" 46 #include "ui/gfx/image/image.h"
47 47
48 using extensions::BundleInstaller; 48 using extensions::BundleInstaller;
49 using extensions::Extension; 49 using extensions::Extension;
50 using extensions::Manifest; 50 using extensions::Manifest;
51 using extensions::PermissionSet; 51 using extensions::PermissionSet;
52 52
53 namespace { 53 namespace {
54 54
55 bool AllowWebstoreData(ExtensionInstallPrompt::PromptType type) {
56 return type == ExtensionInstallPrompt::INLINE_INSTALL_PROMPT ||
57 type == ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT ||
58 type == ExtensionInstallPrompt::REPAIR_PROMPT;
59 }
60
55 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 61 static const int kTitleIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
56 0, // The regular install prompt depends on what's being installed. 62 0, // The regular install prompt depends on what's being installed.
57 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, 63 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE,
58 IDS_EXTENSION_INSTALL_PROMPT_TITLE, 64 IDS_EXTENSION_INSTALL_PROMPT_TITLE,
59 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, 65 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE,
60 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE, 66 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE,
61 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE, 67 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_TITLE,
62 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE, 68 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_TITLE,
63 IDS_EXTENSION_LAUNCH_APP_PROMPT_TITLE, 69 IDS_EXTENSION_LAUNCH_APP_PROMPT_TITLE,
64 0, // The remote install prompt depends on what's being installed. 70 0, // The remote install prompt depends on what's being installed.
71 0, // The repair install prompt depends on what's being installed.
65 }; 72 };
66 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 73 static const int kHeadingIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
67 IDS_EXTENSION_INSTALL_PROMPT_HEADING, 74 IDS_EXTENSION_INSTALL_PROMPT_HEADING,
68 0, // Inline installs use the extension name. 75 0, // Inline installs use the extension name.
69 0, // Heading for bundle installs depends on the bundle contents. 76 0, // Heading for bundle installs depends on the bundle contents.
70 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING, 77 IDS_EXTENSION_RE_ENABLE_PROMPT_HEADING,
71 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING, 78 IDS_EXTENSION_PERMISSIONS_PROMPT_HEADING,
72 0, // External installs use different strings for extensions/apps. 79 0, // External installs use different strings for extensions/apps.
73 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING, 80 IDS_EXTENSION_POST_INSTALL_PERMISSIONS_PROMPT_HEADING,
74 IDS_EXTENSION_LAUNCH_APP_PROMPT_HEADING, 81 IDS_EXTENSION_LAUNCH_APP_PROMPT_HEADING,
75 IDS_EXTENSION_REMOTE_INSTALL_PROMPT_HEADING, 82 IDS_EXTENSION_REMOTE_INSTALL_PROMPT_HEADING,
83 IDS_EXTENSION_REPAIR_PROMPT_HEADING
76 }; 84 };
77 static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 85 static const int kButtons[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
78 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 86 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
79 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 87 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
80 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 88 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
81 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 89 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
82 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 90 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
83 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 91 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
84 ui::DIALOG_BUTTON_CANCEL, 92 ui::DIALOG_BUTTON_CANCEL,
85 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 93 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
86 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, 94 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
95 ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL,
87 }; 96 };
88 static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 97 static const int kAcceptButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
89 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 98 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
90 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 99 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
91 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, 100 IDS_EXTENSION_PROMPT_INSTALL_BUTTON,
92 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON, 101 IDS_EXTENSION_PROMPT_RE_ENABLE_BUTTON,
93 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON, 102 IDS_EXTENSION_PROMPT_PERMISSIONS_BUTTON,
94 0, // External installs use different strings for extensions/apps. 103 0, // External installs use different strings for extensions/apps.
95 IDS_EXTENSION_PROMPT_PERMISSIONS_CLEAR_RETAINED_FILES_BUTTON, 104 IDS_EXTENSION_PROMPT_PERMISSIONS_CLEAR_RETAINED_FILES_BUTTON,
96 IDS_EXTENSION_PROMPT_LAUNCH_BUTTON, 105 IDS_EXTENSION_PROMPT_LAUNCH_BUTTON,
97 IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON, 106 IDS_EXTENSION_PROMPT_REMOTE_INSTALL_BUTTON,
107 IDS_EXTENSION_PROMPT_REPAIR_BUTTON,
98 }; 108 };
99 static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 109 static const int kAbortButtonIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
100 0, // These all use the platform's default cancel label. 110 0, // These all use the platform's default cancel label.
101 0, 111 0,
102 0, 112 0,
103 0, 113 0,
104 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON, 114 IDS_EXTENSION_PROMPT_PERMISSIONS_ABORT_BUTTON,
105 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON, 115 IDS_EXTENSION_EXTERNAL_INSTALL_PROMPT_ABORT_BUTTON,
106 IDS_CLOSE, 116 IDS_CLOSE,
107 0, // Platform dependent cancel button. 117 0, // Platform dependent cancel button.
108 0, 118 0,
119 0,
109 }; 120 };
110 static const int 121 static const int
111 kPermissionsHeaderIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = { 122 kPermissionsHeaderIds[ExtensionInstallPrompt::NUM_PROMPT_TYPES] = {
112 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 123 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
113 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 124 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
114 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO, 125 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO,
115 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO, 126 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO,
116 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO, 127 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO,
117 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 128 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
118 IDS_EXTENSION_PROMPT_CAN_ACCESS, 129 IDS_EXTENSION_PROMPT_CAN_ACCESS,
119 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 130 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
120 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, 131 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO,
132 IDS_EXTENSION_PROMPT_CAN_ACCESS,
121 }; 133 };
122 134
123 // Returns bitmap for the default icon with size equal to the default icon's 135 // Returns bitmap for the default icon with size equal to the default icon's
124 // pixel size under maximal supported scale factor. 136 // pixel size under maximal supported scale factor.
125 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { 137 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
126 const gfx::ImageSkia& image = is_app ? 138 const gfx::ImageSkia& image = is_app ?
127 extensions::util::GetDefaultAppIcon() : 139 extensions::util::GetDefaultAppIcon() :
128 extensions::util::GetDefaultExtensionIcon(); 140 extensions::util::GetDefaultExtensionIcon();
129 return image.GetRepresentation( 141 return image.GetRepresentation(
130 gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap(); 142 gfx::ImageSkia::GetMaxSupportedScale()).sk_bitmap();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 case ExtensionInstallPrompt::PERMISSIONS_PROMPT: 210 case ExtensionInstallPrompt::PERMISSIONS_PROMPT:
199 return "PERMISSIONS_PROMPT"; 211 return "PERMISSIONS_PROMPT";
200 case ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT: 212 case ExtensionInstallPrompt::EXTERNAL_INSTALL_PROMPT:
201 return "EXTERNAL_INSTALL_PROMPT"; 213 return "EXTERNAL_INSTALL_PROMPT";
202 case ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT: 214 case ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT:
203 return "POST_INSTALL_PERMISSIONS_PROMPT"; 215 return "POST_INSTALL_PERMISSIONS_PROMPT";
204 case ExtensionInstallPrompt::LAUNCH_PROMPT: 216 case ExtensionInstallPrompt::LAUNCH_PROMPT:
205 return "LAUNCH_PROMPT"; 217 return "LAUNCH_PROMPT";
206 case ExtensionInstallPrompt::REMOTE_INSTALL_PROMPT: 218 case ExtensionInstallPrompt::REMOTE_INSTALL_PROMPT:
207 return "REMOTE_INSTALL_PROMPT"; 219 return "REMOTE_INSTALL_PROMPT";
220 case ExtensionInstallPrompt::REPAIR_PROMPT:
221 return "REPAIR_PROMPT";
208 case ExtensionInstallPrompt::UNSET_PROMPT_TYPE: 222 case ExtensionInstallPrompt::UNSET_PROMPT_TYPE:
209 case ExtensionInstallPrompt::NUM_PROMPT_TYPES: 223 case ExtensionInstallPrompt::NUM_PROMPT_TYPES:
210 break; 224 break;
211 } 225 }
212 return "OTHER"; 226 return "OTHER";
213 } 227 }
214 228
215 ExtensionInstallPrompt::Prompt::Prompt(PromptType type) 229 ExtensionInstallPrompt::Prompt::Prompt(PromptType type)
216 : type_(type), 230 : type_(type),
217 is_showing_details_for_retained_files_(false), 231 is_showing_details_for_retained_files_(false),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 is_showing_details_for_retained_files_ = is_showing_details; 273 is_showing_details_for_retained_files_ = is_showing_details;
260 break; 274 break;
261 } 275 }
262 } 276 }
263 277
264 void ExtensionInstallPrompt::Prompt::SetWebstoreData( 278 void ExtensionInstallPrompt::Prompt::SetWebstoreData(
265 const std::string& localized_user_count, 279 const std::string& localized_user_count,
266 bool show_user_count, 280 bool show_user_count,
267 double average_rating, 281 double average_rating,
268 int rating_count) { 282 int rating_count) {
269 CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); 283 CHECK(AllowWebstoreData(type_));
270 localized_user_count_ = localized_user_count; 284 localized_user_count_ = localized_user_count;
271 show_user_count_ = show_user_count; 285 show_user_count_ = show_user_count;
272 average_rating_ = average_rating; 286 average_rating_ = average_rating;
273 rating_count_ = rating_count; 287 rating_count_ = rating_count;
274 has_webstore_data_ = true; 288 has_webstore_data_ = true;
275 } 289 }
276 290
277 base::string16 ExtensionInstallPrompt::Prompt::GetDialogTitle() const { 291 base::string16 ExtensionInstallPrompt::Prompt::GetDialogTitle() const {
278 int resource_id = kTitleIds[type_]; 292 int resource_id = kTitleIds[type_];
279 293
280 if (type_ == INSTALL_PROMPT) { 294 if (type_ == INSTALL_PROMPT) {
281 if (extension_->is_app()) 295 if (extension_->is_app())
282 resource_id = IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE; 296 resource_id = IDS_EXTENSION_INSTALL_APP_PROMPT_TITLE;
283 else if (extension_->is_theme()) 297 else if (extension_->is_theme())
284 resource_id = IDS_EXTENSION_INSTALL_THEME_PROMPT_TITLE; 298 resource_id = IDS_EXTENSION_INSTALL_THEME_PROMPT_TITLE;
285 else 299 else
286 resource_id = IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE; 300 resource_id = IDS_EXTENSION_INSTALL_EXTENSION_PROMPT_TITLE;
287 } else if (type_ == EXTERNAL_INSTALL_PROMPT) { 301 } else if (type_ == EXTERNAL_INSTALL_PROMPT) {
288 return l10n_util::GetStringFUTF16( 302 return l10n_util::GetStringFUTF16(
289 resource_id, base::UTF8ToUTF16(extension_->name())); 303 resource_id, base::UTF8ToUTF16(extension_->name()));
290 } else if (type_ == REMOTE_INSTALL_PROMPT) { 304 } else if (type_ == REMOTE_INSTALL_PROMPT) {
291 if (extension_->is_app()) 305 if (extension_->is_app())
292 resource_id = IDS_EXTENSION_REMOTE_INSTALL_APP_PROMPT_TITLE; 306 resource_id = IDS_EXTENSION_REMOTE_INSTALL_APP_PROMPT_TITLE;
293 else 307 else
294 resource_id = IDS_EXTENSION_REMOTE_INSTALL_EXTENSION_PROMPT_TITLE; 308 resource_id = IDS_EXTENSION_REMOTE_INSTALL_EXTENSION_PROMPT_TITLE;
309 } else if (type_ == REPAIR_PROMPT) {
310 if (extension_->is_app())
311 resource_id = IDS_EXTENSION_REPAIR_APP_PROMPT_TITLE;
312 else
313 resource_id = IDS_EXTENSION_REPAIR_EXTENSION_PROMPT_TITLE;
295 } 314 }
296 315
297 return l10n_util::GetStringUTF16(resource_id); 316 return l10n_util::GetStringUTF16(resource_id);
298 } 317 }
299 318
300 base::string16 ExtensionInstallPrompt::Prompt::GetHeading() const { 319 base::string16 ExtensionInstallPrompt::Prompt::GetHeading() const {
301 if (type_ == INLINE_INSTALL_PROMPT) { 320 if (type_ == INLINE_INSTALL_PROMPT) {
302 return base::UTF8ToUTF16(extension_->name()); 321 return base::UTF8ToUTF16(extension_->name());
303 } else if (type_ == BUNDLE_INSTALL_PROMPT) { 322 } else if (type_ == BUNDLE_INSTALL_PROMPT) {
304 return bundle_->GetHeadingTextFor(BundleInstaller::Item::STATE_PENDING); 323 return bundle_->GetHeadingTextFor(BundleInstaller::Item::STATE_PENDING);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 } 420 }
402 421
403 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const { 422 bool ExtensionInstallPrompt::Prompt::ShouldShowPermissions() const {
404 return GetPermissionCount(ALL_PERMISSIONS) > 0 || 423 return GetPermissionCount(ALL_PERMISSIONS) > 0 ||
405 type_ == POST_INSTALL_PERMISSIONS_PROMPT; 424 type_ == POST_INSTALL_PERMISSIONS_PROMPT;
406 } 425 }
407 426
408 void ExtensionInstallPrompt::Prompt::AppendRatingStars( 427 void ExtensionInstallPrompt::Prompt::AppendRatingStars(
409 StarAppender appender, void* data) const { 428 StarAppender appender, void* data) const {
410 CHECK(appender); 429 CHECK(appender);
411 CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); 430 CHECK(AllowWebstoreData(type_));
412 int rating_integer = floor(average_rating_); 431 int rating_integer = floor(average_rating_);
413 double rating_fractional = average_rating_ - rating_integer; 432 double rating_fractional = average_rating_ - rating_integer;
414 433
415 if (rating_fractional > 0.66) { 434 if (rating_fractional > 0.66) {
416 rating_integer++; 435 rating_integer++;
417 } 436 }
418 437
419 if (rating_fractional < 0.33 || rating_fractional > 0.66) { 438 if (rating_fractional < 0.33 || rating_fractional > 0.66) {
420 rating_fractional = 0; 439 rating_fractional = 0;
421 } 440 }
422 441
423 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 442 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
424 int i; 443 int i;
425 for (i = 0; i < rating_integer; i++) { 444 for (i = 0; i < rating_integer; i++) {
426 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_ON), data); 445 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_ON), data);
427 } 446 }
428 if (rating_fractional) { 447 if (rating_fractional) {
429 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data); 448 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_HALF_LEFT), data);
430 i++; 449 i++;
431 } 450 }
432 for (; i < kMaxExtensionRating; i++) { 451 for (; i < kMaxExtensionRating; i++) {
433 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data); 452 appender(rb.GetImageSkiaNamed(IDR_EXTENSIONS_RATING_STAR_OFF), data);
434 } 453 }
435 } 454 }
436 455
437 base::string16 ExtensionInstallPrompt::Prompt::GetRatingCount() const { 456 base::string16 ExtensionInstallPrompt::Prompt::GetRatingCount() const {
438 CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); 457 CHECK(AllowWebstoreData(type_));
439 return l10n_util::GetStringFUTF16(IDS_EXTENSION_RATING_COUNT, 458 return l10n_util::GetStringFUTF16(IDS_EXTENSION_RATING_COUNT,
440 base::IntToString16(rating_count_)); 459 base::IntToString16(rating_count_));
441 } 460 }
442 461
443 base::string16 ExtensionInstallPrompt::Prompt::GetUserCount() const { 462 base::string16 ExtensionInstallPrompt::Prompt::GetUserCount() const {
444 CHECK(type_ == INLINE_INSTALL_PROMPT || type_ == EXTERNAL_INSTALL_PROMPT); 463 CHECK(AllowWebstoreData(type_));
445 464
446 if (show_user_count_) { 465 if (show_user_count_) {
447 return l10n_util::GetStringFUTF16(IDS_EXTENSION_USER_COUNT, 466 return l10n_util::GetStringFUTF16(IDS_EXTENSION_USER_COUNT,
448 base::UTF8ToUTF16(localized_user_count_)); 467 base::UTF8ToUTF16(localized_user_count_));
449 } 468 }
450 return base::string16(); 469 return base::string16();
451 } 470 }
452 471
453 size_t ExtensionInstallPrompt::Prompt::GetPermissionCount( 472 size_t ExtensionInstallPrompt::Prompt::GetPermissionCount(
454 PermissionsType permissions_type) const { 473 PermissionsType permissions_type) const {
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 871 }
853 872
854 switch (prompt_->type()) { 873 switch (prompt_->type()) {
855 case PERMISSIONS_PROMPT: 874 case PERMISSIONS_PROMPT:
856 case RE_ENABLE_PROMPT: 875 case RE_ENABLE_PROMPT:
857 case INLINE_INSTALL_PROMPT: 876 case INLINE_INSTALL_PROMPT:
858 case EXTERNAL_INSTALL_PROMPT: 877 case EXTERNAL_INSTALL_PROMPT:
859 case INSTALL_PROMPT: 878 case INSTALL_PROMPT:
860 case LAUNCH_PROMPT: 879 case LAUNCH_PROMPT:
861 case POST_INSTALL_PERMISSIONS_PROMPT: 880 case POST_INSTALL_PERMISSIONS_PROMPT:
862 case REMOTE_INSTALL_PROMPT: { 881 case REMOTE_INSTALL_PROMPT:
882 case REPAIR_PROMPT: {
863 prompt_->set_extension(extension_); 883 prompt_->set_extension(extension_);
864 prompt_->set_icon(gfx::Image::CreateFrom1xBitmap(icon_)); 884 prompt_->set_icon(gfx::Image::CreateFrom1xBitmap(icon_));
865 break; 885 break;
866 } 886 }
867 case BUNDLE_INSTALL_PROMPT: { 887 case BUNDLE_INSTALL_PROMPT: {
868 prompt_->set_bundle(bundle_); 888 prompt_->set_bundle(bundle_);
869 break; 889 break;
870 } 890 }
871 default: 891 default:
872 NOTREACHED() << "Unknown message"; 892 NOTREACHED() << "Unknown message";
873 return; 893 return;
874 } 894 }
875 895
876 if (AutoConfirmPrompt(delegate_)) 896 if (AutoConfirmPrompt(delegate_))
877 return; 897 return;
878 898
879 if (show_dialog_callback_.is_null()) 899 if (show_dialog_callback_.is_null())
880 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); 900 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
881 else 901 else
882 show_dialog_callback_.Run(show_params_, delegate_, prompt_); 902 show_dialog_callback_.Run(show_params_, delegate_, prompt_);
883 } 903 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698