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 "ui/base/android/system_ui_resource_manager.h" | |
14 | |
15 class SkBitmap; | |
16 | |
17 namespace cc { | |
18 class UIResourceBitmap; | |
19 } | |
20 | |
21 namespace ui { | |
22 class UIResourceProvider; | |
23 } | |
24 | |
25 namespace content { | |
26 | |
27 class SystemUIResource; | |
28 | |
29 class SystemUIResourceManagerImpl : public ui::SystemUIResourceManager { | |
30 public: | |
31 SystemUIResourceManagerImpl(ui::UIResourceProvider* ui_resource_provider); | |
32 virtual ~SystemUIResourceManagerImpl() {} | |
33 | |
34 virtual void Subscribe(ui::SystemUIResourceManager::Type type, | |
35 ui::SystemUIResourceLayer* layer) OVERRIDE; | |
36 virtual void Unsubscribe(ui::SystemUIResourceManager::Type type, | |
37 ui::SystemUIResourceLayer* layer) OVERRIDE; | |
38 virtual void RefreshResourceOnSubscribers( | |
39 ui::SystemUIResourceManager::Type type) OVERRIDE; | |
40 | |
41 private: | |
42 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.
| |
43 public: | |
44 Data(); | |
45 virtual ~Data(); | |
46 void Subscribe(ui::SystemUIResourceLayer* layer); | |
47 void Unsubscribe(ui::SystemUIResourceLayer* layer); | |
48 void SetResource(scoped_ptr<SystemUIResource> resource); | |
49 void RefreshResource(); | |
50 bool HasResource() { return resource_; } | |
51 | |
52 // Implements SystemUIResourceClient. | |
53 virtual void OnUIResourceIdChanged() OVERRIDE; | |
54 | |
55 private: | |
56 typedef ObserverList<ui::SystemUIResourceLayer> Subscribers; | |
57 scoped_ptr<SystemUIResource> resource_; | |
58 Subscribers subscribers_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(Data); | |
61 }; | |
62 | |
63 void BuildResource(ui::SystemUIResourceManager::Type type); | |
64 Data* GetData(ui::SystemUIResourceManager::Type type); | |
65 static void LoadBitmap(ui::SystemUIResourceManager::Type, | |
66 SkBitmap* bitmap_holder); | |
67 void OnFinishedLoadBitmap(ui::SystemUIResourceManager::Type, | |
68 SkBitmap* bitmap_holder); | |
69 | |
70 typedef base::ScopedPtrHashMap<int, Data> SystemUIResourceMap; | |
71 SystemUIResourceMap resource_map_; | |
72 ui::UIResourceProvider* ui_resource_provider_; | |
73 | |
74 base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl); | |
77 }; | |
78 | |
79 } // namespace content | |
80 | |
81 #endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_ | |
OLD | NEW |