| 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 #ifndef EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "extensions/common/extension_icon_set.h" | 16 #include "extensions/common/extension_icon_set.h" |
| 17 #include "ui/base/layout.h" | |
| 18 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 19 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 20 | 19 |
| 21 namespace content { | 20 namespace content { |
| 22 class BrowserContext; | 21 class BrowserContext; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace extensions { | 24 namespace extensions { |
| 26 class Extension; | 25 class Extension; |
| 27 } | 26 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 82 |
| 84 private: | 83 private: |
| 85 class Source; | 84 class Source; |
| 86 | 85 |
| 87 // Loads an image representation for the scale factor. | 86 // Loads an image representation for the scale factor. |
| 88 // If the representation gets loaded synchronously, it is returned by this | 87 // If the representation gets loaded synchronously, it is returned by this |
| 89 // method. | 88 // method. |
| 90 // If representation loading is asynchronous, an empty image | 89 // If representation loading is asynchronous, an empty image |
| 91 // representation is returned. When the representation gets loaded the | 90 // representation is returned. When the representation gets loaded the |
| 92 // observers' OnExtensionIconImageLoaded() will be called. | 91 // observers' OnExtensionIconImageLoaded() will be called. |
| 93 gfx::ImageSkiaRep LoadImageForScaleFactor(ui::ScaleFactor scale_factor); | 92 gfx::ImageSkiaRep LoadImageForScale(float scale); |
| 94 | 93 |
| 95 void OnImageLoaded(float scale_factor, const gfx::Image& image); | 94 void OnImageLoaded(float scale, const gfx::Image& image); |
| 96 | 95 |
| 97 // content::NotificationObserver overrides: | 96 // content::NotificationObserver overrides: |
| 98 void Observe(int type, | 97 void Observe(int type, |
| 99 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
| 100 const content::NotificationDetails& details) override; | 99 const content::NotificationDetails& details) override; |
| 101 | 100 |
| 102 content::BrowserContext* browser_context_; | 101 content::BrowserContext* browser_context_; |
| 103 scoped_refptr<const Extension> extension_; | 102 scoped_refptr<const Extension> extension_; |
| 104 ExtensionIconSet icon_set_; | 103 ExtensionIconSet icon_set_; |
| 105 const int resource_size_in_dip_; | 104 const int resource_size_in_dip_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 119 content::NotificationRegistrar registrar_; | 118 content::NotificationRegistrar registrar_; |
| 120 | 119 |
| 121 base::WeakPtrFactory<IconImage> weak_ptr_factory_; | 120 base::WeakPtrFactory<IconImage> weak_ptr_factory_; |
| 122 | 121 |
| 123 DISALLOW_COPY_AND_ASSIGN(IconImage); | 122 DISALLOW_COPY_AND_ASSIGN(IconImage); |
| 124 }; | 123 }; |
| 125 | 124 |
| 126 } // namespace extensions | 125 } // namespace extensions |
| 127 | 126 |
| 128 #endif // EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ | 127 #endif // EXTENSIONS_BROWSER_EXTENSION_ICON_IMAGE_H_ |
| OLD | NEW |