OLD | NEW |
1 // Copyright (c) 2010 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 #include "chrome/browser/extensions/extension_install_ui.h" | 5 #include "chrome/browser/extensions/extension_install_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING | 56 IDS_EXTENSION_UNINSTALL_PROMPT_HEADING |
57 }; | 57 }; |
58 // static | 58 // static |
59 const int ExtensionInstallUI::kButtonIds[NUM_PROMPT_TYPES] = { | 59 const int ExtensionInstallUI::kButtonIds[NUM_PROMPT_TYPES] = { |
60 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, | 60 IDS_EXTENSION_PROMPT_INSTALL_BUTTON, |
61 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON | 61 IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON |
62 }; | 62 }; |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
| 66 // Size of extension icon in top left of dialog. |
| 67 const int kIconSize = 69; |
| 68 |
66 static void GetV2Warnings(Extension* extension, | 69 static void GetV2Warnings(Extension* extension, |
67 std::vector<string16>* warnings) { | 70 std::vector<string16>* warnings) { |
68 if (!extension->plugins().empty()) { | 71 if (!extension->plugins().empty()) { |
69 // TODO(aa): This one is a bit awkward. Should we have a separate | 72 // TODO(aa): This one is a bit awkward. Should we have a separate |
70 // presentation for this case? | 73 // presentation for this case? |
71 warnings->push_back( | 74 warnings->push_back( |
72 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS)); | 75 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS)); |
73 return; | 76 return; |
74 } | 77 } |
75 | 78 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 case INSTALL_PROMPT: { | 287 case INSTALL_PROMPT: { |
285 // TODO(jcivelli): http://crbug.com/44771 We should not show an install | 288 // TODO(jcivelli): http://crbug.com/44771 We should not show an install |
286 // dialog when installing an app from the gallery. | 289 // dialog when installing an app from the gallery. |
287 NotificationService* service = NotificationService::current(); | 290 NotificationService* service = NotificationService::current(); |
288 service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, | 291 service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, |
289 Source<ExtensionInstallUI>(this), | 292 Source<ExtensionInstallUI>(this), |
290 NotificationService::NoDetails()); | 293 NotificationService::NoDetails()); |
291 | 294 |
292 std::vector<string16> warnings; | 295 std::vector<string16> warnings; |
293 GetV2Warnings(extension_, &warnings); | 296 GetV2Warnings(extension_, &warnings); |
294 ShowExtensionInstallUIPrompt2Impl( | 297 ShowExtensionInstallUIPrompt2Impl(profile_, delegate_, extension_, &icon_, |
295 profile_, delegate_, extension_, &icon_, warnings); | 298 warnings); |
296 break; | 299 break; |
297 } | 300 } |
298 case UNINSTALL_PROMPT: { | 301 case UNINSTALL_PROMPT: { |
299 string16 message = | |
300 l10n_util::GetStringUTF16(IDS_EXTENSION_UNINSTALL_CONFIRMATION); | |
301 ShowExtensionInstallUIPromptImpl(profile_, delegate_, extension_, &icon_, | 302 ShowExtensionInstallUIPromptImpl(profile_, delegate_, extension_, &icon_, |
302 message, UNINSTALL_PROMPT); | 303 UNINSTALL_PROMPT); |
303 break; | 304 break; |
304 } | 305 } |
305 default: | 306 default: |
306 NOTREACHED() << "Unknown message"; | 307 NOTREACHED() << "Unknown message"; |
307 break; | 308 break; |
308 } | 309 } |
309 } | 310 } |
310 | 311 |
311 void ExtensionInstallUI::ShowThemeInfoBar( | 312 void ExtensionInstallUI::ShowThemeInfoBar( |
312 const std::string& previous_theme_id, bool previous_use_system_theme, | 313 const std::string& previous_theme_id, bool previous_use_system_theme, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 else | 354 else |
354 tab_contents->AddInfoBar(new_delegate); | 355 tab_contents->AddInfoBar(new_delegate); |
355 } | 356 } |
356 | 357 |
357 void ExtensionInstallUI::ShowConfirmation(PromptType prompt_type) { | 358 void ExtensionInstallUI::ShowConfirmation(PromptType prompt_type) { |
358 // Load the image asynchronously. For the response, check OnImageLoaded. | 359 // Load the image asynchronously. For the response, check OnImageLoaded. |
359 prompt_type_ = prompt_type; | 360 prompt_type_ = prompt_type; |
360 ExtensionResource image = | 361 ExtensionResource image = |
361 extension_->GetIconResource(Extension::EXTENSION_ICON_LARGE); | 362 extension_->GetIconResource(Extension::EXTENSION_ICON_LARGE); |
362 tracker_.LoadImage(extension_, image, | 363 tracker_.LoadImage(extension_, image, |
363 gfx::Size(Extension::EXTENSION_ICON_LARGE, | 364 gfx::Size(kIconSize, kIconSize), |
364 Extension::EXTENSION_ICON_LARGE), | |
365 ImageLoadingTracker::DONT_CACHE); | 365 ImageLoadingTracker::DONT_CACHE); |
366 } | 366 } |
367 | 367 |
368 #if defined(OS_MACOSX) | 368 #if defined(OS_MACOSX) |
369 void ExtensionInstallUI::ShowGenericExtensionInstalledInfoBar( | 369 void ExtensionInstallUI::ShowGenericExtensionInstalledInfoBar( |
370 Extension* new_extension) { | 370 Extension* new_extension) { |
371 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 371 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
372 if (!browser) | 372 if (!browser) |
373 return; | 373 return; |
374 | 374 |
(...skipping 16 matching lines...) Expand all Loading... |
391 TabContents* tab_contents, Extension* new_theme, | 391 TabContents* tab_contents, Extension* new_theme, |
392 const std::string& previous_theme_id, bool previous_use_system_theme) { | 392 const std::string& previous_theme_id, bool previous_use_system_theme) { |
393 #if defined(TOOLKIT_GTK) | 393 #if defined(TOOLKIT_GTK) |
394 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme, | 394 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme, |
395 previous_theme_id, previous_use_system_theme); | 395 previous_theme_id, previous_use_system_theme); |
396 #else | 396 #else |
397 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, | 397 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, |
398 previous_theme_id); | 398 previous_theme_id); |
399 #endif | 399 #endif |
400 } | 400 } |
OLD | NEW |