OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ | |
6 #define CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/containers/scoped_ptr_hash_map.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "content/common/content_export.h" | |
12 #include "ui/base/android/system_ui_resource_manager.h" | |
13 | |
14 class SkBitmap; | |
15 | |
16 namespace cc { | |
17 class UIResourceBitmap; | |
18 } | |
19 | |
20 namespace content { | |
21 | |
22 class UIResourceProvider; | |
23 | |
24 class CONTENT_EXPORT SystemUIResourceManagerImpl | |
25 : public ui::SystemUIResourceManager { | |
26 public: | |
27 explicit SystemUIResourceManagerImpl( | |
28 UIResourceProvider* ui_resource_provider); | |
29 virtual ~SystemUIResourceManagerImpl(); | |
30 | |
31 virtual void PreloadResource(ResourceType type) OVERRIDE; | |
32 virtual cc::UIResourceId GetUIResourceId(ResourceType type) OVERRIDE; | |
33 | |
34 private: | |
35 friend class TestSystemUIResourceManagerImpl; | |
36 class Entry; | |
37 | |
38 // Start loading the resource bitmap. virtual for testing. | |
39 virtual void BuildResource(ResourceType type); | |
40 | |
41 Entry* GetEntry(ResourceType type); | |
42 static void LoadBitmap(ResourceType, SkBitmap* bitmap_holder); | |
43 void OnFinishedLoadBitmap(ResourceType, SkBitmap* bitmap_holder); | |
44 | |
45 scoped_ptr<Entry> resource_map_[RESOURCE_TYPE_LAST + 1]; | |
46 UIResourceProvider* ui_resource_provider_; | |
47 | |
48 base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl); | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ | |
OLD | NEW |