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

Side by Side Diff: services/native_viewport/platform_viewport_x11.cc

Issue 1280613003: Allow native_viewport to create new native windows on demand on Android. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/native_viewport/platform_viewport.h" 5 #include "services/native_viewport/platform_viewport.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h" 9 #include "mojo/converters/geometry/geometry_type_converters.h"
10 #include "mojo/converters/input_events/input_events_type_converters.h" 10 #include "mojo/converters/input_events/input_events_type_converters.h"
(...skipping 16 matching lines...) Expand all
27 return std::max( 27 return std::max(
28 -1.0f, std::min(1.0f, static_cast<float>(offset) / 28 -1.0f, std::min(1.0f, static_cast<float>(offset) /
29 (20 * static_cast<float>( 29 (20 * static_cast<float>(
30 ui::MouseWheelEvent::kWheelDelta)))); 30 ui::MouseWheelEvent::kWheelDelta))));
31 } 31 }
32 } // namespace 32 } // namespace
33 33
34 class PlatformViewportX11 : public PlatformViewport, 34 class PlatformViewportX11 : public PlatformViewport,
35 public ui::PlatformWindowDelegate { 35 public ui::PlatformWindowDelegate {
36 public: 36 public:
37 explicit PlatformViewportX11(Delegate* delegate) : delegate_(delegate) { 37 explicit PlatformViewportX11(Delegate* delegate) : delegate_(delegate) {}
38 }
39 38
40 ~PlatformViewportX11() override { 39 ~PlatformViewportX11() override {
41 // Destroy the platform-window while |this| is still alive. 40 // Destroy the platform-window while |this| is still alive.
42 platform_window_.reset(); 41 platform_window_.reset();
43 } 42 }
44 43
45 private: 44 private:
46 // Overridden from PlatformViewport: 45 // Overridden from PlatformViewport:
47 void Init(const gfx::Rect& bounds) override { 46 void Init(const gfx::Rect& bounds) override {
48 CHECK(!event_source_); 47 CHECK(!event_source_);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void OnWindowStateChanged(ui::PlatformWindowState state) override {} 143 void OnWindowStateChanged(ui::PlatformWindowState state) override {}
145 144
146 void OnLostCapture() override {} 145 void OnLostCapture() override {}
147 146
148 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override { 147 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override {
149 delegate_->OnAcceleratedWidgetAvailable(widget); 148 delegate_->OnAcceleratedWidgetAvailable(widget);
150 } 149 }
151 150
152 void OnActivationChanged(bool active) override {} 151 void OnActivationChanged(bool active) override {}
153 152
153 bool NewNativeSurfaceAvailable() override {
154 NOTIMPLEMENTED() << "Native surface attaching not implemented.";
155 return false;
156 }
157
154 scoped_ptr<ui::PlatformEventSource> event_source_; 158 scoped_ptr<ui::PlatformEventSource> event_source_;
155 scoped_ptr<ui::PlatformWindow> platform_window_; 159 scoped_ptr<ui::PlatformWindow> platform_window_;
156 Delegate* delegate_; 160 Delegate* delegate_;
157 mojo::ViewportMetricsPtr metrics_; 161 mojo::ViewportMetricsPtr metrics_;
158 162
159 DISALLOW_COPY_AND_ASSIGN(PlatformViewportX11); 163 DISALLOW_COPY_AND_ASSIGN(PlatformViewportX11);
160 }; 164 };
161 165
162 // static 166 // static
163 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) { 167 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) {
164 return make_scoped_ptr(new PlatformViewportX11(delegate)); 168 return make_scoped_ptr(new PlatformViewportX11(delegate));
165 } 169 }
166 170
167 } // namespace native_viewport 171 } // namespace native_viewport
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698