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

Unified Diff: blimp/client/core/contents/blimp_contents_view_impl.h

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Addressed more comments, added thread restriction bypass for tests. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/contents/blimp_contents_view_impl.h
diff --git a/blimp/client/core/contents/blimp_contents_view_impl.h b/blimp/client/core/contents/blimp_contents_view_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..8aa1c03cf68115c7e17ad4246c9e7ff9ca3902f6
--- /dev/null
+++ b/blimp/client/core/contents/blimp_contents_view_impl.h
@@ -0,0 +1,71 @@
+// 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_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_
+#define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "blimp/client/core/contents/ime_feature.h"
+#include "blimp/client/public/contents/blimp_contents_view.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace cc {
+class CopyOutputResult;
+}
+
+namespace blimp {
+namespace client {
+class BlimpContentsImpl;
+
+// The internal generic implementation of a BlimpContentsView that implements
+// the common functionality shared across platforms. Meant to be overridden and
+// implemented for each supported platform.
+class BlimpContentsViewImpl : public BlimpContentsView {
+ public:
+ // A factory method that needs to be implemented for each supported platform.
+ static std::unique_ptr<BlimpContentsViewImpl> Create(
+ BlimpContentsImpl* blimp_contents,
+ scoped_refptr<cc::Layer> contents_layer);
+
+ ~BlimpContentsViewImpl() override;
+
+ // Exposes the plaform specific ImeFeature::Delegate. This should handle text
+ // input requests and present them to the user.
+ virtual ImeFeature::Delegate* GetImeDelegate() = 0;
+
+ // BlimpContentsView implementation.
+ scoped_refptr<cc::Layer> GetLayer() override;
+ void SetSizeAndScale(const gfx::Size& size,
+ float device_scale_factor) override;
+ bool OnTouchEvent(const ui::MotionEvent& motion_event) override;
+ void CopyFromCompositingSurface(const ReadbackRequestCallback& callback,
+ bool flush_pending_commits) override;
+
+ protected:
+ BlimpContentsViewImpl(BlimpContentsImpl* blimp_contents,
+ scoped_refptr<cc::Layer> contents_layer);
+
+ private:
+ void StartReadbackRequest();
+ void OnReadbackComplete(std::unique_ptr<cc::CopyOutputResult> result);
+
+ BlimpContentsImpl* blimp_contents_;
+ scoped_refptr<cc::Layer> contents_layer_;
+
+ // The callback for any outstanding readback request.
+ ReadbackRequestCallback readback_callback_;
+
+ base::WeakPtrFactory<BlimpContentsViewImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpContentsViewImpl);
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_VIEW_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698