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"
18 class UIResourceBitmap
;
23 class UIResourceProvider
;
25 class CONTENT_EXPORT SystemUIResourceManagerImpl
26 : public ui::SystemUIResourceManager
{
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
);
38 friend class TestSystemUIResourceManagerImpl
;
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_