summaryrefslogtreecommitdiffstats
path: root/content/browser/android/system_ui_resource_manager_impl.h
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 17:51:26 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-07 17:51:26 +0000
commitc8d99c55420d20c707e67289d093d419409312ea (patch)
tree76c91224f1b8dccc4d9fc6532ab762e21386b90d /content/browser/android/system_ui_resource_manager_impl.h
parentfad702abf56e417e12e7e8ac442e8a1ca615a1eb (diff)
downloadchromium_src-c8d99c55420d20c707e67289d093d419409312ea.zip
chromium_src-c8d99c55420d20c707e67289d093d419409312ea.tar.gz
chromium_src-c8d99c55420d20c707e67289d093d419409312ea.tar.bz2
[Android] Use UIResource for overscroll glow
Introduce a SystemUIResourceManager class for loading and providing access to shared UIResourceId's. Wire this class to the existing OverscrollGlow effect, using the shared id's with a UIResourceLayer for both glow and edge layers. This patch is a subset of powei@'s original SystemUIResource patch found at https://codereview.chromium.org/377013002/. BUG=326326 Review URL: https://codereview.chromium.org/422013003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/android/system_ui_resource_manager_impl.h')
-rw-r--r--content/browser/android/system_ui_resource_manager_impl.h55
1 files changed, 55 insertions, 0 deletions
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 0000000..c5792a1
--- /dev/null
+++ b/content/browser/android/system_ui_resource_manager_impl.h
@@ -0,0 +1,55 @@
+// 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 PreloadResource(ResourceType type) OVERRIDE;
+ virtual cc::UIResourceId GetUIResourceId(ResourceType type) OVERRIDE;
+
+ private:
+ friend class TestSystemUIResourceManagerImpl;
+ class Entry;
+
+ // Start loading the resource bitmap. virtual for testing.
+ virtual void BuildResource(ResourceType type);
+
+ Entry* GetEntry(ResourceType type);
+ static void LoadBitmap(ResourceType, SkBitmap* bitmap_holder);
+ void OnFinishedLoadBitmap(ResourceType, SkBitmap* bitmap_holder);
+
+ scoped_ptr<Entry> resource_map_[RESOURCE_TYPE_LAST + 1];
+ 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_