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

Side by Side Diff: extensions/browser/extension_icon_image.cc

Issue 448193002: Cleanup: Make ExtensionIconSet::Get return a const std::string& rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/extensions/sandboxed_unpacker.cc ('k') | extensions/common/extension_icon_set.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/extension_icon_image.h" 5 #include "extensions/browser/extension_icon_image.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 29 matching lines...) Expand all
40 40
41 namespace { 41 namespace {
42 42
43 const int kMatchBiggerTreshold = 32; 43 const int kMatchBiggerTreshold = 32;
44 44
45 extensions::ExtensionResource GetExtensionIconResource( 45 extensions::ExtensionResource GetExtensionIconResource(
46 const extensions::Extension* extension, 46 const extensions::Extension* extension,
47 const ExtensionIconSet& icons, 47 const ExtensionIconSet& icons,
48 int size, 48 int size,
49 ExtensionIconSet::MatchType match_type) { 49 ExtensionIconSet::MatchType match_type) {
50 std::string path = icons.Get(size, match_type); 50 const std::string& path = icons.Get(size, match_type);
51 if (path.empty()) 51 return path.empty() ? extensions::ExtensionResource()
52 return extensions::ExtensionResource(); 52 : extension->GetResource(path);
53
54 return extension->GetResource(path);
55 } 53 }
56 54
57 class BlankImageSource : public gfx::CanvasImageSource { 55 class BlankImageSource : public gfx::CanvasImageSource {
58 public: 56 public:
59 explicit BlankImageSource(const gfx::Size& size_in_dip) 57 explicit BlankImageSource(const gfx::Size& size_in_dip)
60 : CanvasImageSource(size_in_dip, /*is_opaque =*/ false) { 58 : CanvasImageSource(size_in_dip, /*is_opaque =*/ false) {
61 } 59 }
62 virtual ~BlankImageSource() {} 60 virtual ~BlankImageSource() {}
63 61
64 private: 62 private:
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const content::NotificationDetails& details) { 228 const content::NotificationDetails& details) {
231 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); 229 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED);
232 230
233 const Extension* extension = content::Details<const Extension>(details).ptr(); 231 const Extension* extension = content::Details<const Extension>(details).ptr();
234 232
235 if (extension_ == extension) 233 if (extension_ == extension)
236 extension_ = NULL; 234 extension_ = NULL;
237 } 235 }
238 236
239 } // namespace extensions 237 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/sandboxed_unpacker.cc ('k') | extensions/common/extension_icon_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698