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

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.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_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/file_util.h" 10 #include "base/file_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // we need to update FetchOAuthIssueAdviceIfNeeded. 97 // we need to update FetchOAuthIssueAdviceIfNeeded.
98 0, 98 0,
99 }; 99 };
100 100
101 // Size of extension icon in top left of dialog. 101 // Size of extension icon in top left of dialog.
102 const int kIconSize = 69; 102 const int kIconSize = 69;
103 103
104 // Returns pixel size under maximal scale factor for the icon whose device 104 // Returns pixel size under maximal scale factor for the icon whose device
105 // independent size is |size_in_dip| 105 // independent size is |size_in_dip|
106 int GetSizeForMaxScaleFactor(int size_in_dip) { 106 int GetSizeForMaxScaleFactor(int size_in_dip) {
107 float max_scale_factor_scale = 107 std::vector<ui::ScaleFactor> supported_scale_factors =
108 ui::GetScaleFactorScale(ui::GetMaxScaleFactor()); 108 ui::GetSupportedScaleFactors();
109 // Scale factors are in ascending order, so the last one is the one we need.
110 ui::ScaleFactor max_scale_factor = supported_scale_factors.back();
111 float max_scale_factor_scale = ui::GetScaleFactorScale(max_scale_factor);
112
109 return static_cast<int>(size_in_dip * max_scale_factor_scale); 113 return static_cast<int>(size_in_dip * max_scale_factor_scale);
110 } 114 }
111 115
112 // Returns bitmap for the default icon with size equal to the default icon's 116 // Returns bitmap for the default icon with size equal to the default icon's
113 // pixel size under maximal supported scale factor. 117 // pixel size under maximal supported scale factor.
114 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { 118 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) {
119 std::vector<ui::ScaleFactor> supported_scale_factors =
120 ui::GetSupportedScaleFactors();
121 // Scale factors are in ascending order, so the last one is the one we need.
122 ui::ScaleFactor max_scale_factor =
123 supported_scale_factors[supported_scale_factors.size() - 1];
124
115 return Extension::GetDefaultIcon(is_app). 125 return Extension::GetDefaultIcon(is_app).
116 GetRepresentation(ui::GetMaxScaleFactor()).sk_bitmap(); 126 GetRepresentation(max_scale_factor).sk_bitmap();
117 } 127 }
118 128
119 // If auto confirm is enabled then posts a task to proceed with or cancel the 129 // If auto confirm is enabled then posts a task to proceed with or cancel the
120 // install and returns true. Otherwise returns false. 130 // install and returns true. Otherwise returns false.
121 bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) { 131 bool AutoConfirmPrompt(ExtensionInstallPrompt::Delegate* delegate) {
122 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); 132 const CommandLine* cmdline = CommandLine::ForCurrentProcess();
123 if (!cmdline->HasSwitch(switches::kAppsGalleryInstallAutoConfirmForTests)) 133 if (!cmdline->HasSwitch(switches::kAppsGalleryInstallAutoConfirmForTests))
124 return false; 134 return false;
125 std::string value = cmdline->GetSwitchValueASCII( 135 std::string value = cmdline->GetSwitchValueASCII(
126 switches::kAppsGalleryInstallAutoConfirmForTests); 136 switches::kAppsGalleryInstallAutoConfirmForTests);
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 if (AutoConfirmPrompt(delegate_)) 634 if (AutoConfirmPrompt(delegate_))
625 return; 635 return;
626 636
627 if (show_dialog_callback_.is_null()) { 637 if (show_dialog_callback_.is_null()) {
628 GetDefaultShowDialogCallback().Run( 638 GetDefaultShowDialogCallback().Run(
629 parent_web_contents_, delegate_, prompt_); 639 parent_web_contents_, delegate_, prompt_);
630 } else { 640 } else {
631 show_dialog_callback_.Run(parent_web_contents_, delegate_, prompt_); 641 show_dialog_callback_.Run(parent_web_contents_, delegate_, prompt_);
632 } 642 }
633 } 643 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/helper.cc ('k') | chrome/browser/extensions/extension_uninstall_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698