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

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

Issue 11418021: Revert 168079 - This CL ensures that favicons always (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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_uninstall_dialog.h" 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/extension_constants.h" 11 #include "chrome/common/extensions/extension_constants.h"
12 #include "chrome/common/extensions/extension_icon_set.h" 12 #include "chrome/common/extensions/extension_icon_set.h"
13 #include "chrome/common/extensions/extension_resource.h" 13 #include "chrome/common/extensions/extension_resource.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
16 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
17 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
18 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 20
21 namespace { 21 namespace {
22 22
23 // Returns pixel size under maximal scale factor for the icon whose device 23 // Returns pixel size under maximal scale factor for the icon whose device
24 // independent size is |size_in_dip| 24 // independent size is |size_in_dip|
25 int GetSizeForMaxScaleFactor(int size_in_dip) { 25 int GetSizeForMaxScaleFactor(int size_in_dip) {
26 ui::ScaleFactor max_scale_factor = ui::GetMaxScaleFactor(); 26 std::vector<ui::ScaleFactor> supported_scale_factors =
27 ui::GetSupportedScaleFactors();
28 // Scale factors are in ascending order, so the last one is the one we need.
29 ui::ScaleFactor max_scale_factor = supported_scale_factors.back();
27 float max_scale_factor_scale = ui::GetScaleFactorScale(max_scale_factor); 30 float max_scale_factor_scale = ui::GetScaleFactorScale(max_scale_factor);
28 31
29 return static_cast<int>(size_in_dip * max_scale_factor_scale); 32 return static_cast<int>(size_in_dip * max_scale_factor_scale);
30 } 33 }
31 34
32 // Returns bitmap for the default icon with size equal to the default icon's 35 // Returns bitmap for the default icon with size equal to the default icon's
33 // pixel size under maximal supported scale factor. 36 // pixel size under maximal supported scale factor.
34 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { 37 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
38 std::vector<ui::ScaleFactor> supported_scale_factors =
39 ui::GetSupportedScaleFactors();
40 // Scale factors are in ascending order, so the last one is the one we need.
41 ui::ScaleFactor max_scale_factor =
42 supported_scale_factors[supported_scale_factors.size() - 1];
43
35 return extensions::Extension::GetDefaultIcon(is_app). 44 return extensions::Extension::GetDefaultIcon(is_app).
36 GetRepresentation(ui::GetMaxScaleFactor()).sk_bitmap(); 45 GetRepresentation(max_scale_factor).sk_bitmap();
37 } 46 }
38 47
39 } // namespace 48 } // namespace
40 49
41 // Size of extension icon in top left of dialog. 50 // Size of extension icon in top left of dialog.
42 static const int kIconSize = 69; 51 static const int kIconSize = 69;
43 52
44 ExtensionUninstallDialog::ExtensionUninstallDialog( 53 ExtensionUninstallDialog::ExtensionUninstallDialog(
45 Browser* browser, 54 Browser* browser,
46 ExtensionUninstallDialog::Delegate* delegate) 55 ExtensionUninstallDialog::Delegate* delegate)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); 118 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING);
110 119
111 browser_ = NULL; 120 browser_ = NULL;
112 if (tracker_.get()) { 121 if (tracker_.get()) {
113 // If we're waiting for the icon, stop doing so because we're not going to 122 // If we're waiting for the icon, stop doing so because we're not going to
114 // show the dialog. 123 // show the dialog.
115 tracker_.reset(); 124 tracker_.reset();
116 delegate_->ExtensionUninstallCanceled(); 125 delegate_->ExtensionUninstallCanceled();
117 } 126 }
118 } 127 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_prompt.cc ('k') | chrome/browser/extensions/extension_web_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698