Chromium Code Reviews| 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/app_shortcut_manager.h" | 5 #include "chrome/browser/extensions/app_shortcut_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/web_applications/web_app.h" | 10 #include "chrome/browser/web_applications/web_app.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 shortcut_info_.create_on_desktop = true; | 105 shortcut_info_.create_on_desktop = true; |
| 106 shortcut_info_.profile_path = profile_->GetPath(); | 106 shortcut_info_.profile_path = profile_->GetPath(); |
| 107 | 107 |
| 108 std::vector<ImageLoadingTracker::ImageInfo> info_list; | 108 std::vector<ImageLoadingTracker::ImageInfo> info_list; |
| 109 for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) { | 109 for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) { |
| 110 int size = kDesiredSizes[i]; | 110 int size = kDesiredSizes[i]; |
| 111 ExtensionResource resource = extension->GetIconResource( | 111 ExtensionResource resource = extension->GetIconResource( |
| 112 size, ExtensionIconSet::MATCH_EXACTLY); | 112 size, ExtensionIconSet::MATCH_EXACTLY); |
| 113 if (!resource.empty()) { | 113 if (!resource.empty()) { |
| 114 info_list.push_back( | 114 info_list.push_back( |
| 115 ImageLoadingTracker::ImageInfo(resource, gfx::Size(size, size))); | 115 ImageLoadingTracker::ImageInfo(resource, |
| 116 gfx::Size(size, size), | |
| 117 ui::SCALE_FACTOR_NONE)); | |
|
pkotwicz
2012/07/16 17:33:52
ui::SCALE_FACTOR_100P
xiyuan
2012/07/16 20:11:27
Changed but AppShortcutManager loads multi-resolut
| |
| 116 } | 118 } |
| 117 } | 119 } |
| 118 | 120 |
| 119 if (info_list.empty()) { | 121 if (info_list.empty()) { |
| 120 size_t i = arraysize(kDesiredSizes) - 1; | 122 size_t i = arraysize(kDesiredSizes) - 1; |
| 121 int size = kDesiredSizes[i]; | 123 int size = kDesiredSizes[i]; |
| 122 | 124 |
| 123 // If there is no icon at the desired sizes, we will resize what we can get. | 125 // If there is no icon at the desired sizes, we will resize what we can get. |
| 124 // Making a large icon smaller is prefered to making a small icon larger, so | 126 // Making a large icon smaller is prefered to making a small icon larger, so |
| 125 // look for a larger icon first: | 127 // look for a larger icon first: |
| 126 ExtensionResource resource = extension->GetIconResource( | 128 ExtensionResource resource = extension->GetIconResource( |
| 127 size, ExtensionIconSet::MATCH_BIGGER); | 129 size, ExtensionIconSet::MATCH_BIGGER); |
| 128 if (resource.empty()) { | 130 if (resource.empty()) { |
| 129 resource = extension->GetIconResource( | 131 resource = extension->GetIconResource( |
| 130 size, ExtensionIconSet::MATCH_SMALLER); | 132 size, ExtensionIconSet::MATCH_SMALLER); |
| 131 } | 133 } |
| 132 info_list.push_back( | 134 info_list.push_back( |
| 133 ImageLoadingTracker::ImageInfo(resource, gfx::Size(size, size))); | 135 ImageLoadingTracker::ImageInfo(resource, |
| 136 gfx::Size(size, size), | |
| 137 ui::SCALE_FACTOR_NONE)); | |
|
pkotwicz
2012/07/16 17:33:52
Change this to ui::SCALE_FACTOR_100P
xiyuan
2012/07/16 20:11:27
Done.
| |
| 134 } | 138 } |
| 135 | 139 |
| 136 // |icon_resources| may still be empty at this point, in which case LoadImage | 140 // |icon_resources| may still be empty at this point, in which case LoadImage |
| 137 // will call the OnImageLoaded callback with an empty image and exit | 141 // will call the OnImageLoaded callback with an empty image and exit |
| 138 // immediately. | 142 // immediately. |
| 139 tracker_.LoadImages(extension, info_list, ImageLoadingTracker::DONT_CACHE); | 143 tracker_.LoadImages(extension, info_list, ImageLoadingTracker::DONT_CACHE); |
| 140 } | 144 } |
| OLD | NEW |