OLD | NEW |
---|---|
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO, | 113 IDS_EXTENSION_PROMPT_THESE_WILL_HAVE_ACCESS_TO, |
114 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO, | 114 IDS_EXTENSION_PROMPT_WILL_NOW_HAVE_ACCESS_TO, |
115 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO, | 115 IDS_EXTENSION_PROMPT_WANTS_ACCESS_TO, |
116 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, | 116 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
117 IDS_EXTENSION_PROMPT_CAN_ACCESS, | 117 IDS_EXTENSION_PROMPT_CAN_ACCESS, |
118 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, | 118 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
119 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, | 119 IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO, |
120 }; | 120 }; |
121 | 121 |
122 // Size of extension icon in top left of dialog. | 122 // Size of extension icon in top left of dialog. |
123 const int kIconSize = 69; | 123 const int kIconSize = 64; |
124 | 124 |
125 // Returns pixel size under maximal scale factor for the icon whose device | 125 // Returns pixel size under maximal scale factor for the icon whose device |
126 // independent size is |size_in_dip| | 126 // independent size is |size_in_dip| |
127 int GetSizeForMaxScaleFactor(int size_in_dip) { | 127 int GetSizeForMaxScaleFactor(int size_in_dip) { |
128 return static_cast<int>(size_in_dip * gfx::ImageSkia::GetMaxSupportedScale()); | 128 return static_cast<int>(size_in_dip * gfx::ImageSkia::GetMaxSupportedScale()); |
129 } | 129 } |
130 | 130 |
131 // Returns bitmap for the default icon with size equal to the default icon's | 131 // Returns bitmap for the default icon with size equal to the default icon's |
132 // pixel size under maximal supported scale factor. | 132 // pixel size under maximal supported scale factor. |
133 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { | 133 SkBitmap GetDefaultIconBitmapForMaxScaleFactor(bool is_app) { |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 } | 691 } |
692 | 692 |
693 // Load the image asynchronously. For the response, check OnImageLoaded. | 693 // Load the image asynchronously. For the response, check OnImageLoaded. |
694 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( | 694 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( |
695 extension_, | 695 extension_, |
696 extension_misc::EXTENSION_ICON_LARGE, | 696 extension_misc::EXTENSION_ICON_LARGE, |
697 ExtensionIconSet::MATCH_BIGGER); | 697 ExtensionIconSet::MATCH_BIGGER); |
698 // Load the icon whose pixel size is large enough to be displayed under | 698 // Load the icon whose pixel size is large enough to be displayed under |
699 // maximal supported scale factor. UI code will scale the icon down if needed. | 699 // maximal supported scale factor. UI code will scale the icon down if needed. |
700 // TODO(tbarzic): We should use IconImage here and load the required bitmap | 700 // TODO(tbarzic): We should use IconImage here and load the required bitmap |
701 // lazily. | 701 // lazily. |
calamity
2014/05/30 08:45:25
Leave this TODO.
| |
702 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); | 702 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); |
703 extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync( | 703 extensions::ImageLoader::Get(install_ui_->profile())->LoadImageAsync( |
704 extension_, image, gfx::Size(pixel_size, pixel_size), | 704 extension_, image, gfx::Size(pixel_size, pixel_size), |
705 base::Bind(&ExtensionInstallPrompt::OnImageLoaded, AsWeakPtr())); | 705 base::Bind(&ExtensionInstallPrompt::OnImageLoaded, AsWeakPtr())); |
706 } | 706 } |
707 | 707 |
708 void ExtensionInstallPrompt::ShowConfirmation() { | 708 void ExtensionInstallPrompt::ShowConfirmation() { |
709 if (prompt_.type() == INSTALL_PROMPT) | 709 if (prompt_.type() == INSTALL_PROMPT) |
710 prompt_.set_experiment(ExtensionInstallPromptExperiment::Find()); | 710 prompt_.set_experiment(ExtensionInstallPromptExperiment::Find()); |
711 else | 711 else |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 } | 748 } |
749 | 749 |
750 if (AutoConfirmPrompt(delegate_)) | 750 if (AutoConfirmPrompt(delegate_)) |
751 return; | 751 return; |
752 | 752 |
753 if (show_dialog_callback_.is_null()) | 753 if (show_dialog_callback_.is_null()) |
754 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); | 754 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); |
755 else | 755 else |
756 show_dialog_callback_.Run(show_params_, delegate_, prompt_); | 756 show_dialog_callback_.Run(show_params_, delegate_, prompt_); |
757 } | 757 } |
OLD | NEW |