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..7fa1ce6433179a6d9b9995ba5f1c361511c25277 |
--- /dev/null |
+++ b/content/browser/android/system_ui_resource_manager_impl.h |
@@ -0,0 +1,81 @@ |
+// 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 "base/observer_list.h" |
+#include "content/browser/android/system_ui_resource.h" |
+#include "ui/base/android/system_ui_resource_manager.h" |
+ |
+class SkBitmap; |
+ |
+namespace cc { |
+class UIResourceBitmap; |
+} |
+ |
+namespace ui { |
+class UIResourceProvider; |
+} |
+ |
+namespace content { |
+ |
+class SystemUIResource; |
+ |
+class SystemUIResourceManagerImpl : public ui::SystemUIResourceManager { |
+ public: |
+ SystemUIResourceManagerImpl(ui::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; |
+ virtual void RefreshResourceOnSubscribers( |
+ ui::SystemUIResourceManager::Type type) OVERRIDE; |
+ |
+ private: |
+ class Data : public SystemUIResourceClient { |
jdduke (slow)
2014/07/16 19:01:51
Could we just forward declare Data here as an inne
powei
2014/07/16 23:33:51
Seems like I can't forward declare and use it with
jdduke (slow)
2014/07/17 00:02:18
Try moving the SystemUIResourceManagerImpl destruc
powei
2014/07/21 21:25:58
Done. That worked. Thanks.
|
+ public: |
+ Data(); |
+ virtual ~Data(); |
+ void Subscribe(ui::SystemUIResourceLayer* layer); |
+ void Unsubscribe(ui::SystemUIResourceLayer* layer); |
+ void SetResource(scoped_ptr<SystemUIResource> resource); |
+ void RefreshResource(); |
+ bool HasResource() { return resource_; } |
+ |
+ // Implements SystemUIResourceClient. |
+ virtual void OnUIResourceIdChanged() OVERRIDE; |
+ |
+ private: |
+ typedef ObserverList<ui::SystemUIResourceLayer> Subscribers; |
+ scoped_ptr<SystemUIResource> resource_; |
+ Subscribers subscribers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Data); |
+ }; |
+ |
+ void BuildResource(ui::SystemUIResourceManager::Type type); |
+ Data* GetData(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, Data> SystemUIResourceMap; |
+ SystemUIResourceMap resource_map_; |
+ ui::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_ |