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/basictypes.h" |
| 9 #include "base/containers/scoped_ptr_hash_map.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/observer_list.h" |
| 12 #include "content/browser/android/system_ui_resource.h" |
| 13 #include "content/common/content_export.h" |
| 14 #include "ui/base/android/system_ui_resource_manager.h" |
| 15 |
| 16 class SkBitmap; |
| 17 |
| 18 namespace cc { |
| 19 class UIResourceBitmap; |
| 20 } |
| 21 |
| 22 namespace content { |
| 23 |
| 24 class SystemUIResource; |
| 25 |
| 26 class CONTENT_EXPORT SystemUIResourceManagerImpl |
| 27 : public ui::SystemUIResourceManager { |
| 28 public: |
| 29 SystemUIResourceManagerImpl(UIResourceProvider* ui_resource_provider); |
| 30 ~SystemUIResourceManagerImpl(); |
| 31 |
| 32 virtual void Subscribe(ui::SystemUIResourceManager::Type type, |
| 33 ui::SystemUIResourceLayer* layer) OVERRIDE; |
| 34 virtual void Unsubscribe(ui::SystemUIResourceManager::Type type, |
| 35 ui::SystemUIResourceLayer* layer) OVERRIDE; |
| 36 void RefreshResources(); |
| 37 |
| 38 private: |
| 39 friend class TestSystemUIResourceManagerImpl; |
| 40 class Entry; |
| 41 |
| 42 // Start loading the resource bitmap. virtual for testing. |
| 43 virtual void BuildResource(ui::SystemUIResourceManager::Type type); |
| 44 |
| 45 Entry* GetEntry(ui::SystemUIResourceManager::Type type); |
| 46 static void LoadBitmap(ui::SystemUIResourceManager::Type, |
| 47 SkBitmap* bitmap_holder); |
| 48 void OnFinishedLoadBitmap(ui::SystemUIResourceManager::Type, |
| 49 SkBitmap* bitmap_holder); |
| 50 |
| 51 typedef base::ScopedPtrHashMap<int, Entry> SystemUIResourceMap; |
| 52 SystemUIResourceMap resource_map_; |
| 53 UIResourceProvider* ui_resource_provider_; |
| 54 |
| 55 base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl); |
| 58 }; |
| 59 |
| 60 } // namespace content |
| 61 |
| 62 #endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ |
OLD | NEW |