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

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

Issue 9428025: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 #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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 22 matching lines...) Expand all
33 #include "chrome/common/extensions/extension_icon_set.h" 33 #include "chrome/common/extensions/extension_icon_set.h"
34 #include "chrome/common/extensions/extension_resource.h" 34 #include "chrome/common/extensions/extension_resource.h"
35 #include "chrome/common/extensions/url_pattern.h" 35 #include "chrome/common/extensions/url_pattern.h"
36 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "grit/chromium_strings.h" 38 #include "grit/chromium_strings.h"
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
40 #include "grit/theme_resources.h" 40 #include "grit/theme_resources.h"
41 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/gfx/image/image.h"
43 44
44 using content::WebContents; 45 using content::WebContents;
45 46
46 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { 47 static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = {
47 0, 48 0,
48 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE, 49 IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE,
49 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE, 50 IDS_EXTENSION_RE_ENABLE_PROMPT_TITLE,
50 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE 51 IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE
51 }; 52 };
52 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { 53 static const int kHeadingIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 309
309 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 310 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
310 if (disable_failure_ui_for_tests) 311 if (disable_failure_ui_for_tests)
311 return; 312 return;
312 browser::ShowErrorBox( 313 browser::ShowErrorBox(
313 browser ? browser->window()->GetNativeHandle() : NULL, 314 browser ? browser->window()->GetNativeHandle() : NULL,
314 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_FAILURE_TITLE), 315 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_FAILURE_TITLE),
315 error); 316 error);
316 } 317 }
317 318
318 void ExtensionInstallUI::SetIcon(SkBitmap* image) { 319 void ExtensionInstallUI::SetIcon(const SkBitmap* image) {
319 if (image) 320 if (image)
320 icon_ = *image; 321 icon_ = *image;
321 else 322 else
322 icon_ = SkBitmap(); 323 icon_ = SkBitmap();
323 if (icon_.empty()) 324 if (icon_.empty())
324 icon_ = Extension::GetDefaultIcon(extension_->is_app()); 325 icon_ = Extension::GetDefaultIcon(extension_->is_app());
325 } 326 }
326 327
327 void ExtensionInstallUI::OnImageLoaded( 328 void ExtensionInstallUI::OnImageLoaded(const gfx::Image* image,
328 SkBitmap* image, const ExtensionResource& resource, int index) { 329 const std::string& extension_id,
329 SetIcon(image); 330 int index) {
331 SetIcon(image ? image->ToSkBitmap() : NULL);
330 332
331 switch (prompt_type_) { 333 switch (prompt_type_) {
332 case PERMISSIONS_PROMPT: 334 case PERMISSIONS_PROMPT:
333 case RE_ENABLE_PROMPT: 335 case RE_ENABLE_PROMPT:
334 case INSTALL_PROMPT: { 336 case INSTALL_PROMPT: {
335 content::NotificationService* service = 337 content::NotificationService* service =
336 content::NotificationService::current(); 338 content::NotificationService::current();
337 service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, 339 service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
338 content::Source<ExtensionInstallUI>(this), 340 content::Source<ExtensionInstallUI>(this),
339 content::NotificationService::NoDetails()); 341 content::NotificationService::NoDetails());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 bool previous_using_native_theme) { 432 bool previous_using_native_theme) {
431 Profile* profile = tab_contents->profile(); 433 Profile* profile = tab_contents->profile();
432 return new ThemeInstalledInfoBarDelegate( 434 return new ThemeInstalledInfoBarDelegate(
433 tab_contents->infobar_tab_helper(), 435 tab_contents->infobar_tab_helper(),
434 profile->GetExtensionService(), 436 profile->GetExtensionService(),
435 ThemeServiceFactory::GetForProfile(profile), 437 ThemeServiceFactory::GetForProfile(profile),
436 new_theme, 438 new_theme,
437 previous_theme_id, 439 previous_theme_id,
438 previous_using_native_theme); 440 previous_using_native_theme);
439 } 441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698