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

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

Issue 10825012: chromeos: Fix pixelated icons in app list and launcher (part 2) (by xiyuan) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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/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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 shortcut_info_.url = GURL(extension->launch_web_url()); 99 shortcut_info_.url = GURL(extension->launch_web_url());
100 shortcut_info_.title = UTF8ToUTF16(extension->name()); 100 shortcut_info_.title = UTF8ToUTF16(extension->name());
101 shortcut_info_.description = UTF8ToUTF16(extension->description()); 101 shortcut_info_.description = UTF8ToUTF16(extension->description());
102 shortcut_info_.extension_path = extension->path(); 102 shortcut_info_.extension_path = extension->path();
103 shortcut_info_.is_platform_app = extension->is_platform_app(); 103 shortcut_info_.is_platform_app = extension->is_platform_app();
104 shortcut_info_.create_in_applications_menu = true; 104 shortcut_info_.create_in_applications_menu = true;
105 shortcut_info_.create_in_quick_launch_bar = true; 105 shortcut_info_.create_in_quick_launch_bar = true;
106 shortcut_info_.create_on_desktop = true; 106 shortcut_info_.create_on_desktop = true;
107 shortcut_info_.profile_path = profile_->GetPath(); 107 shortcut_info_.profile_path = profile_->GetPath();
108 108
109 std::vector<ImageLoadingTracker::ImageInfo> info_list; 109 std::vector<ImageLoadingTracker::ImageRepresentation> info_list;
110 for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) { 110 for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) {
111 int size = kDesiredSizes[i]; 111 int size = kDesiredSizes[i];
112 ExtensionResource resource = extension->GetIconResource( 112 ExtensionResource resource = extension->GetIconResource(
113 size, ExtensionIconSet::MATCH_EXACTLY); 113 size, ExtensionIconSet::MATCH_EXACTLY);
114 if (!resource.empty()) { 114 if (!resource.empty()) {
115 info_list.push_back( 115 info_list.push_back(ImageLoadingTracker::ImageRepresentation(
116 ImageLoadingTracker::ImageInfo(resource, gfx::Size(size, size))); 116 resource,
117 ImageLoadingTracker::ImageRepresentation::RESIZE_WHEN_LARGER,
118 gfx::Size(size, size),
119 ui::SCALE_FACTOR_100P));
117 } 120 }
118 } 121 }
119 122
120 if (info_list.empty()) { 123 if (info_list.empty()) {
121 size_t i = arraysize(kDesiredSizes) - 1; 124 size_t i = arraysize(kDesiredSizes) - 1;
122 int size = kDesiredSizes[i]; 125 int size = kDesiredSizes[i];
123 126
124 // If there is no icon at the desired sizes, we will resize what we can get. 127 // If there is no icon at the desired sizes, we will resize what we can get.
125 // Making a large icon smaller is prefered to making a small icon larger, so 128 // Making a large icon smaller is prefered to making a small icon larger, so
126 // look for a larger icon first: 129 // look for a larger icon first:
127 ExtensionResource resource = extension->GetIconResource( 130 ExtensionResource resource = extension->GetIconResource(
128 size, ExtensionIconSet::MATCH_BIGGER); 131 size, ExtensionIconSet::MATCH_BIGGER);
129 if (resource.empty()) { 132 if (resource.empty()) {
130 resource = extension->GetIconResource( 133 resource = extension->GetIconResource(
131 size, ExtensionIconSet::MATCH_SMALLER); 134 size, ExtensionIconSet::MATCH_SMALLER);
132 } 135 }
133 info_list.push_back( 136 info_list.push_back(ImageLoadingTracker::ImageRepresentation(
134 ImageLoadingTracker::ImageInfo(resource, gfx::Size(size, size))); 137 resource,
138 ImageLoadingTracker::ImageRepresentation::RESIZE_WHEN_LARGER,
139 gfx::Size(size, size),
140 ui::SCALE_FACTOR_100P));
135 } 141 }
136 142
137 // |icon_resources| may still be empty at this point, in which case LoadImage 143 // |icon_resources| may still be empty at this point, in which case LoadImage
138 // will call the OnImageLoaded callback with an empty image and exit 144 // will call the OnImageLoaded callback with an empty image and exit
139 // immediately. 145 // immediately.
140 tracker_.LoadImages(extension, info_list, ImageLoadingTracker::DONT_CACHE); 146 tracker_.LoadImages(extension, info_list, ImageLoadingTracker::DONT_CACHE);
141 } 147 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_icon_image.h » ('j') | chrome/browser/extensions/extension_icon_image.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698