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

Side by Side Diff: chrome/browser/ui/webui/extension_icon_source.cc

Issue 7553020: Revert 94715 - Revert 94714 - Improve layout for bookmark-apps. Add treatment for small icons. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merging to head Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/extension_icon_source.h" 5 #include "chrome/browser/ui/webui/extension_icon_source.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 ExtensionIconSource::~ExtensionIconSource() { 69 ExtensionIconSource::~ExtensionIconSource() {
70 // Clean up all the temporary data we're holding for requests. 70 // Clean up all the temporary data we're holding for requests.
71 STLDeleteValues(&request_map_); 71 STLDeleteValues(&request_map_);
72 } 72 }
73 73
74 // static 74 // static
75 GURL ExtensionIconSource::GetIconURL(const Extension* extension, 75 GURL ExtensionIconSource::GetIconURL(const Extension* extension,
76 Extension::Icons icon_size, 76 Extension::Icons icon_size,
77 ExtensionIconSet::MatchType match, 77 ExtensionIconSet::MatchType match,
78 bool grayscale) { 78 bool grayscale,
79 bool* exists) {
80 if (exists)
81 *exists = true;
79 if (extension->id() == extension_misc::kWebStoreAppId) 82 if (extension->id() == extension_misc::kWebStoreAppId)
80 return GURL("chrome://theme/IDR_WEBSTORE_ICON"); 83 return GURL("chrome://theme/IDR_WEBSTORE_ICON");
81 84
85 if (exists && extension->GetIconURL(icon_size, match) == GURL())
86 *exists = false;
87
82 GURL icon_url(base::StringPrintf("%s%s/%d/%d%s", 88 GURL icon_url(base::StringPrintf("%s%s/%d/%d%s",
83 chrome::kChromeUIExtensionIconURL, 89 chrome::kChromeUIExtensionIconURL,
84 extension->id().c_str(), 90 extension->id().c_str(),
85 icon_size, 91 icon_size,
86 match, 92 match,
87 grayscale ? "?grayscale=true" : "")); 93 grayscale ? "?grayscale=true" : ""));
88 CHECK(icon_url.is_valid()); 94 CHECK(icon_url.is_valid());
89 return icon_url; 95 return icon_url;
90 } 96 }
91 97
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 323
318 void ExtensionIconSource::ClearData(int request_id) { 324 void ExtensionIconSource::ClearData(int request_id) {
319 std::map<int, ExtensionIconRequest*>::iterator i = 325 std::map<int, ExtensionIconRequest*>::iterator i =
320 request_map_.find(request_id); 326 request_map_.find(request_id);
321 if (i == request_map_.end()) 327 if (i == request_map_.end())
322 return; 328 return;
323 329
324 delete i->second; 330 delete i->second;
325 request_map_.erase(i); 331 request_map_.erase(i);
326 } 332 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extension_icon_source.h ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698