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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 class BlankImageSource : public gfx::CanvasImageSource { | 53 class BlankImageSource : public gfx::CanvasImageSource { |
54 public: | 54 public: |
55 explicit BlankImageSource(const gfx::Size& size_in_dip) | 55 explicit BlankImageSource(const gfx::Size& size_in_dip) |
56 : CanvasImageSource(size_in_dip, /*is_opaque =*/ false) { | 56 : CanvasImageSource(size_in_dip, /*is_opaque =*/ false) { |
57 } | 57 } |
58 virtual ~BlankImageSource() {} | 58 virtual ~BlankImageSource() {} |
59 | 59 |
60 private: | 60 private: |
61 // gfx::CanvasImageSource overrides: | 61 // gfx::CanvasImageSource overrides: |
62 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { | 62 virtual void Draw(gfx::Canvas* canvas) override { |
63 canvas->DrawColor(SkColorSetARGB(0, 0, 0, 0)); | 63 canvas->DrawColor(SkColorSetARGB(0, 0, 0, 0)); |
64 } | 64 } |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(BlankImageSource); | 66 DISALLOW_COPY_AND_ASSIGN(BlankImageSource); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 namespace extensions { | 71 namespace extensions { |
72 | 72 |
73 //////////////////////////////////////////////////////////////////////////////// | 73 //////////////////////////////////////////////////////////////////////////////// |
74 // IconImage::Source | 74 // IconImage::Source |
75 | 75 |
76 class IconImage::Source : public gfx::ImageSkiaSource { | 76 class IconImage::Source : public gfx::ImageSkiaSource { |
77 public: | 77 public: |
78 Source(IconImage* host, const gfx::Size& size_in_dip); | 78 Source(IconImage* host, const gfx::Size& size_in_dip); |
79 virtual ~Source(); | 79 virtual ~Source(); |
80 | 80 |
81 void ResetHost(); | 81 void ResetHost(); |
82 | 82 |
83 private: | 83 private: |
84 // gfx::ImageSkiaSource overrides: | 84 // gfx::ImageSkiaSource overrides: |
85 virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE; | 85 virtual gfx::ImageSkiaRep GetImageForScale(float scale) override; |
86 | 86 |
87 // Used to load images, possibly asynchronously. NULLed out when the IconImage | 87 // Used to load images, possibly asynchronously. NULLed out when the IconImage |
88 // is destroyed. | 88 // is destroyed. |
89 IconImage* host_; | 89 IconImage* host_; |
90 | 90 |
91 // Image whose representations will be used until |host_| loads the real | 91 // Image whose representations will be used until |host_| loads the real |
92 // representations for the image. | 92 // representations for the image. |
93 gfx::ImageSkia blank_image_; | 93 gfx::ImageSkia blank_image_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(Source); | 95 DISALLOW_COPY_AND_ASSIGN(Source); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 const content::NotificationDetails& details) { | 225 const content::NotificationDetails& details) { |
226 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); | 226 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_REMOVED); |
227 | 227 |
228 const Extension* extension = content::Details<const Extension>(details).ptr(); | 228 const Extension* extension = content::Details<const Extension>(details).ptr(); |
229 | 229 |
230 if (extension_ == extension) | 230 if (extension_ == extension) |
231 extension_ = NULL; | 231 extension_ = NULL; |
232 } | 232 } |
233 | 233 |
234 } // namespace extensions | 234 } // namespace extensions |
OLD | NEW |