OLD | NEW |
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 Loading... |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 152 |
154 scoped_ptr<ui::PlatformEventSource> event_source_; | 153 scoped_ptr<ui::PlatformEventSource> event_source_; |
155 scoped_ptr<ui::PlatformWindow> platform_window_; | 154 scoped_ptr<ui::PlatformWindow> platform_window_; |
156 Delegate* delegate_; | 155 Delegate* delegate_; |
157 mojo::ViewportMetricsPtr metrics_; | 156 mojo::ViewportMetricsPtr metrics_; |
158 | 157 |
159 DISALLOW_COPY_AND_ASSIGN(PlatformViewportX11); | 158 DISALLOW_COPY_AND_ASSIGN(PlatformViewportX11); |
160 }; | 159 }; |
161 | 160 |
162 // static | 161 // static |
163 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) { | 162 scoped_ptr<PlatformViewport> PlatformViewport::Create( |
| 163 mojo::ApplicationImpl* application_, |
| 164 Delegate* delegate) { |
164 return make_scoped_ptr(new PlatformViewportX11(delegate)); | 165 return make_scoped_ptr(new PlatformViewportX11(delegate)); |
165 } | 166 } |
166 | 167 |
167 } // namespace native_viewport | 168 } // namespace native_viewport |
OLD | NEW |