| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |