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

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

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

Powered by Google App Engine
This is Rietveld 408576698