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