Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / android / system_ui_resource_manager_impl.h
blob493949cee301d2b30375f3c496ce445b114ff9c8
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.
5 #ifndef CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_
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"
15 class SkBitmap;
17 namespace cc {
18 class UIResourceBitmap;
21 namespace content {
23 class UIResourceProvider;
25 class CONTENT_EXPORT SystemUIResourceManagerImpl
26 : public ui::SystemUIResourceManager {
27 public:
28 explicit SystemUIResourceManagerImpl(
29 UIResourceProvider* ui_resource_provider);
30 ~SystemUIResourceManagerImpl() override;
32 void PreloadResource(ui::SystemUIResourceType type) override;
33 cc::UIResourceId GetUIResourceId(ui::SystemUIResourceType type) override;
35 static bool RegisterUIResources(JNIEnv* env);
37 private:
38 friend class TestSystemUIResourceManagerImpl;
39 class Entry;
41 // Start loading the resource bitmap. virtual for testing.
42 virtual void BuildResource(ui::SystemUIResourceType type);
44 Entry* GetEntry(ui::SystemUIResourceType type);
45 void OnFinishedLoadBitmap(ui::SystemUIResourceType, SkBitmap* bitmap_holder);
47 scoped_ptr<Entry> resource_map_[ui::SYSTEM_UI_RESOURCE_TYPE_LAST + 1];
48 UIResourceProvider* ui_resource_provider_;
50 base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_;
52 DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl);
55 } // namespace content
57 #endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_