Chromium Code Reviews| Index: blimp/client/core/render_widget/blimp_document.h |
| diff --git a/blimp/client/core/render_widget/blimp_document.h b/blimp/client/core/render_widget/blimp_document.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..223cec77593c3f444e7e420d73b4320cc4b7e677 |
| --- /dev/null |
| +++ b/blimp/client/core/render_widget/blimp_document.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2016 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 BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_H_ |
| +#define BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ptr_util.h" |
| +#include "blimp/client/core/compositor/blimp_compositor.h" |
| + |
| +namespace blimp { |
| +namespace client { |
| + |
| +class BlimpCompositorDependencies; |
| +class BlimpDocumentManager; |
| + |
| +// BlimpDocument maps to an engine side render widget. |
| +// 1. Is created on receiving an RenderWidgetMessage from the engine. |
| +// 2. Owns the BlimpCompositor instance. |
| +class BlimpDocument : public BlimpCompositorClient { |
| + public: |
| + BlimpDocument(int render_widget_id, |
| + BlimpCompositorDependencies* compositor_dependencies, |
| + BlimpDocumentManager* document_manager); |
| + ~BlimpDocument() override; |
| + |
| + int render_widget_id() const { return render_widget_id_; } |
| + |
| + // Returns the compositor instance. |
| + BlimpCompositor* GetCompositor(); |
| + |
| + protected: |
| + void SetCompositorForTest(std::unique_ptr<BlimpCompositor> compositor); |
| + |
| + private: |
| + // BlimpCompositorClient implementation. |
| + void SendWebGestureEvent( |
| + const blink::WebGestureEvent& gesture_event) override; |
| + void SendCompositorMessage( |
| + const cc::proto::CompositorMessage& message) override; |
| + |
| + // The unique identifier for this document instance. |
| + const int render_widget_id_; |
|
Khushal
2016/10/03 20:04:59
Should we rename this to document id in that case?
xingliu
2016/10/04 18:33:49
Rename most of it, except the functions parameters
Khushal
2016/10/04 18:49:54
Sounds good. The RenderWidgetFeature should die on
|
| + |
| + // The compositor instance. |
| + std::unique_ptr<BlimpCompositor> compositor_; |
| + |
| + // The BlimpDocumentManager that manages a list of BlimpDocuments, and holds |
| + // a network message processor. |
| + BlimpDocumentManager* manager_; |
|
Khushal
2016/10/03 20:04:59
You can just comment about why this is here, used
xingliu
2016/10/04 18:33:49
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlimpDocument); |
| +}; |
| + |
| +} // namespace client |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_H_ |