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

Side by Side Diff: chrome/browser/extensions/image_loader.h

Issue 197413002: Move extensions-related files to using //components/keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 13 #include "components/keyed_service/core/keyed_service.h"
14 #include "extensions/common/extension_resource.h" 14 #include "extensions/common/extension_resource.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "ui/base/layout.h" 16 #include "ui/base/layout.h"
17 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
18 18
19 namespace content { 19 namespace content {
20 class BrowserContext; 20 class BrowserContext;
21 } 21 }
22 22
23 namespace gfx { 23 namespace gfx {
24 class Image; 24 class Image;
25 } 25 }
26 26
27 namespace extensions { 27 namespace extensions {
28 28
29 class Extension; 29 class Extension;
30 30
31 typedef base::Callback<void(const gfx::Image&)> ImageLoaderCallback; 31 typedef base::Callback<void(const gfx::Image&)> ImageLoaderCallback;
32 32
33 // This class is responsible for asynchronously loading extension images and 33 // This class is responsible for asynchronously loading extension images and
34 // calling a callback when an image is loaded. 34 // calling a callback when an image is loaded.
35 // The views need to load their icons asynchronously might be deleted before 35 // The views need to load their icons asynchronously might be deleted before
36 // the images have loaded. If you pass your callback using a weak_ptr, this 36 // the images have loaded. If you pass your callback using a weak_ptr, this
37 // will make sure the callback won't be called after the view is deleted. 37 // will make sure the callback won't be called after the view is deleted.
38 class ImageLoader : public BrowserContextKeyedService { 38 class ImageLoader : public KeyedService {
39 public: 39 public:
40 // Information about a singe image representation to load from an extension 40 // Information about a singe image representation to load from an extension
41 // resource. 41 // resource.
42 struct ImageRepresentation { 42 struct ImageRepresentation {
43 // Enum values to indicate whether to resize loaded bitmap when it is larger 43 // Enum values to indicate whether to resize loaded bitmap when it is larger
44 // than |desired_size| or always resize it. 44 // than |desired_size| or always resize it.
45 enum ResizeCondition { 45 enum ResizeCondition {
46 RESIZE_WHEN_LARGER, 46 RESIZE_WHEN_LARGER,
47 ALWAYS_RESIZE, 47 ALWAYS_RESIZE,
48 }; 48 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const std::vector<LoadResult>& load_result); 107 const std::vector<LoadResult>& load_result);
108 108
109 base::WeakPtrFactory<ImageLoader> weak_ptr_factory_; 109 base::WeakPtrFactory<ImageLoader> weak_ptr_factory_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(ImageLoader); 111 DISALLOW_COPY_AND_ASSIGN(ImageLoader);
112 }; 112 };
113 113
114 } // namespace extensions 114 } // namespace extensions
115 115
116 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_ 116 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model_factory.cc ('k') | chrome/browser/extensions/image_loader_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698