Index: content/browser/android/system_ui_resource_manager_impl.h |
diff --git a/content/browser/android/system_ui_resource_manager_impl.h b/content/browser/android/system_ui_resource_manager_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6db875b9be6e048db35e3b90db491de0a6206ac |
--- /dev/null |
+++ b/content/browser/android/system_ui_resource_manager_impl.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ |
+#define CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/containers/scoped_ptr_hash_map.h" |
+#include "base/memory/weak_ptr.h" |
+#include "content/common/content_export.h" |
+#include "ui/base/android/system_ui_resource_manager.h" |
+ |
+class SkBitmap; |
+ |
+namespace cc { |
+class UIResourceBitmap; |
+} |
+ |
+namespace content { |
+ |
+class UIResourceProvider; |
+ |
+class CONTENT_EXPORT SystemUIResourceManagerImpl |
+ : public ui::SystemUIResourceManager { |
+ public: |
+ explicit SystemUIResourceManagerImpl( |
+ UIResourceProvider* ui_resource_provider); |
+ virtual ~SystemUIResourceManagerImpl(); |
+ |
+ virtual void Subscribe(ui::SystemUIResourceManager::Type type, |
+ ui::SystemUIResourceLayer* layer) OVERRIDE; |
+ virtual void Unsubscribe(ui::SystemUIResourceManager::Type type, |
+ ui::SystemUIResourceLayer* layer) OVERRIDE; |
+ |
+ // Reload each of the system bitmaps as UIResource and push the new |
+ // UIResourceId to the corresponding UIResourceLayers. This method is |
+ // necessary for when the UIResources have been invalidated and needs to be |
+ // reloaded. The caller of this method should know if UIResourceProvider is |
+ // in a valid state and use this method accordingly. |
+ void RefreshResources(); |
+ |
+ private: |
+ friend class TestSystemUIResourceManagerImpl; |
+ class Entry; |
+ |
+ // Start loading the resource bitmap. virtual for testing. |
+ virtual void BuildResource(ui::SystemUIResourceManager::Type type); |
+ |
+ Entry* GetEntry(ui::SystemUIResourceManager::Type type); |
+ static void LoadBitmap(ui::SystemUIResourceManager::Type, |
+ SkBitmap* bitmap_holder); |
+ void OnFinishedLoadBitmap(ui::SystemUIResourceManager::Type, |
+ SkBitmap* bitmap_holder); |
+ |
+ typedef base::ScopedPtrHashMap<int, Entry> SystemUIResourceMap; |
+ SystemUIResourceMap resource_map_; |
+ UIResourceProvider* ui_resource_provider_; |
+ |
+ base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ |