Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: content/browser/android/system_ui_resource_manager_impl.h

Issue 377013002: android: Use UIResource for overscroll glow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "content/common/content_export.h"
12 #include "ui/base/android/system_ui_resource_manager.h"
13
14 class SkBitmap;
15
16 namespace cc {
17 class UIResourceBitmap;
18 }
19
20 namespace content {
21
22 class UIResourceProvider;
23
24 class CONTENT_EXPORT SystemUIResourceManagerImpl
25 : public ui::SystemUIResourceManager {
26 public:
27 explicit SystemUIResourceManagerImpl(
28 UIResourceProvider* ui_resource_provider);
29 virtual ~SystemUIResourceManagerImpl();
30
31 virtual void Subscribe(ui::SystemUIResourceManager::Type type,
32 ui::SystemUIResourceLayer* layer) OVERRIDE;
33 virtual void Unsubscribe(ui::SystemUIResourceManager::Type type,
34 ui::SystemUIResourceLayer* layer) OVERRIDE;
35
36 // Reload each of the system bitmaps as UIResource and push the new
37 // UIResourceId to the corresponding UIResourceLayers. This method is
38 // necessary for when the UIResources have been invalidated and needs to be
39 // reloaded. The caller of this method should know if UIResourceProvider is
40 // in a valid state and use this method accordingly.
41 void RefreshResources();
42
43 private:
44 friend class TestSystemUIResourceManagerImpl;
45 class Entry;
46
47 // Start loading the resource bitmap. virtual for testing.
48 virtual void BuildResource(ui::SystemUIResourceManager::Type type);
49
50 Entry* GetEntry(ui::SystemUIResourceManager::Type type);
51 static void LoadBitmap(ui::SystemUIResourceManager::Type,
52 SkBitmap* bitmap_holder);
53 void OnFinishedLoadBitmap(ui::SystemUIResourceManager::Type,
54 SkBitmap* bitmap_holder);
55
56 typedef base::ScopedPtrHashMap<int, Entry> SystemUIResourceMap;
57 SystemUIResourceMap resource_map_;
58 UIResourceProvider* ui_resource_provider_;
59
60 base::WeakPtrFactory<SystemUIResourceManagerImpl> weak_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(SystemUIResourceManagerImpl);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698