| Index: content/browser/android/system_ui_resource.h
|
| diff --git a/content/browser/android/system_ui_resource.h b/content/browser/android/system_ui_resource.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..42e03b1a107f29e7e52a15bd9bbded5fe8be6747
|
| --- /dev/null
|
| +++ b/content/browser/android/system_ui_resource.h
|
| @@ -0,0 +1,68 @@
|
| +// 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_H_
|
| +#define CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_H_
|
| +
|
| +#include "cc/resources/ui_resource_client.h"
|
| +#include "content/public/browser/android/ui_resource_client_android.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| +
|
| +namespace content {
|
| +
|
| +class UIResourceProvider;
|
| +
|
| +class SystemUIResourceClient {
|
| + public:
|
| + // Notifies the user of SystemUIResource that the UIResourceId has changed.
|
| + // The change can be due to UIResource creation or invalidation. The typical
|
| + // user might want to forward the changed UIResourceId to the associated
|
| + // cc::UIResourceLayers.
|
| + virtual void OnUIResourceIdChanged() = 0;
|
| + virtual ~SystemUIResourceClient() {}
|
| +};
|
| +
|
| +// SystemUIResource loads a Android system bitmap into a cc UI resource.
|
| +// We assume that the given bitmap is immutable and SystemUIResource will keep a
|
| +// reference to the given bitmap pixels.
|
| +class SystemUIResource : public UIResourceClientAndroid {
|
| + public:
|
| + static scoped_ptr<SystemUIResource> Create(const SkBitmap& bitmap,
|
| + UIResourceProvider* provider);
|
| +
|
| + virtual ~SystemUIResource();
|
| +
|
| + // cc::UIResourceClient implementation.
|
| + virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid,
|
| + bool resource_lost) OVERRIDE;
|
| +
|
| + // content::UIResourceClientAndroid implementation.
|
| + virtual void UIResourceIsInvalid() OVERRIDE;
|
| +
|
| + // |Load()| is the manual trigger (and the only trigger) to generate a
|
| + // UIResource from the bitmap. This method is necessary because the
|
| + // UIResourceId can be invalidated through the UIResourceClientAndroid
|
| + // callback. It is the responsibility of the owner of SystemUIResource to
|
| + // call |Load()| to initially generate a UIResource, and to call |Load()|
|
| + // again whenever the UIResource is invalidated.
|
| + void Load();
|
| +
|
| + void SetClient(SystemUIResourceClient* client);
|
| +
|
| + cc::UIResourceId id() const { return id_; }
|
| +
|
| + private:
|
| + SystemUIResource(const SkBitmap& bitmap, UIResourceProvider* provider);
|
| +
|
| + SkBitmap bitmap_;
|
| + cc::UIResourceId id_;
|
| + UIResourceProvider* provider_;
|
| + SystemUIResourceClient* client_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SystemUIResource);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_ANDROID_SYSTEM_UI_RESOURCE_H_
|
|
|