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