OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/native_viewport/platform_viewport.h" | 5 #include "mojo/services/native_viewport/platform_viewport.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/platform/platform_event_dispatcher.h" | 8 #include "ui/events/platform/platform_event_dispatcher.h" |
9 #include "ui/events/platform/platform_event_source.h" | 9 #include "ui/events/platform/platform_event_source.h" |
10 #include "ui/ozone/public/cursor_factory_ozone.h" | 10 #include "ui/ozone/public/cursor_factory_ozone.h" |
(...skipping 13 matching lines...) Loading... |
24 ui::OzonePlatform::InitializeForUI(); | 24 ui::OzonePlatform::InitializeForUI(); |
25 } | 25 } |
26 | 26 |
27 virtual ~PlatformViewportOzone() { | 27 virtual ~PlatformViewportOzone() { |
28 // Destroy the platform-window while |this| is still alive. | 28 // Destroy the platform-window while |this| is still alive. |
29 platform_window_.reset(); | 29 platform_window_.reset(); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 // Overridden from PlatformViewport: | 33 // Overridden from PlatformViewport: |
34 virtual void Init(const gfx::Rect& bounds) OVERRIDE { | 34 virtual void Init(const gfx::Rect& bounds) override { |
35 platform_window_ = | 35 platform_window_ = |
36 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); | 36 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); |
37 } | 37 } |
38 | 38 |
39 virtual void Show() OVERRIDE { platform_window_->Show(); } | 39 virtual void Show() override { platform_window_->Show(); } |
40 | 40 |
41 virtual void Hide() OVERRIDE { platform_window_->Hide(); } | 41 virtual void Hide() override { platform_window_->Hide(); } |
42 | 42 |
43 virtual void Close() OVERRIDE { platform_window_->Close(); } | 43 virtual void Close() override { platform_window_->Close(); } |
44 | 44 |
45 virtual gfx::Size GetSize() OVERRIDE { | 45 virtual gfx::Size GetSize() override { |
46 return platform_window_->GetBounds().size(); | 46 return platform_window_->GetBounds().size(); |
47 } | 47 } |
48 | 48 |
49 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE { | 49 virtual void SetBounds(const gfx::Rect& bounds) override { |
50 platform_window_->SetBounds(bounds); | 50 platform_window_->SetBounds(bounds); |
51 } | 51 } |
52 | 52 |
53 virtual void SetCapture() OVERRIDE { platform_window_->SetCapture(); } | 53 virtual void SetCapture() override { platform_window_->SetCapture(); } |
54 | 54 |
55 virtual void ReleaseCapture() OVERRIDE { platform_window_->ReleaseCapture(); } | 55 virtual void ReleaseCapture() override { platform_window_->ReleaseCapture(); } |
56 | 56 |
57 // ui::PlatformWindowDelegate: | 57 // ui::PlatformWindowDelegate: |
58 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE { | 58 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override { |
59 delegate_->OnBoundsChanged(new_bounds); | 59 delegate_->OnBoundsChanged(new_bounds); |
60 } | 60 } |
61 | 61 |
62 virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE {} | 62 virtual void OnDamageRect(const gfx::Rect& damaged_region) override {} |
63 | 63 |
64 virtual void DispatchEvent(ui::Event* event) OVERRIDE { | 64 virtual void DispatchEvent(ui::Event* event) override { |
65 delegate_->OnEvent(event); | 65 delegate_->OnEvent(event); |
66 } | 66 } |
67 | 67 |
68 virtual void OnCloseRequest() OVERRIDE { platform_window_->Close(); } | 68 virtual void OnCloseRequest() override { platform_window_->Close(); } |
69 | 69 |
70 virtual void OnClosed() OVERRIDE { delegate_->OnDestroyed(); } | 70 virtual void OnClosed() override { delegate_->OnDestroyed(); } |
71 | 71 |
72 virtual void OnWindowStateChanged(ui::PlatformWindowState state) OVERRIDE {} | 72 virtual void OnWindowStateChanged(ui::PlatformWindowState state) override {} |
73 | 73 |
74 virtual void OnLostCapture() OVERRIDE {} | 74 virtual void OnLostCapture() override {} |
75 | 75 |
76 virtual void OnAcceleratedWidgetAvailable( | 76 virtual void OnAcceleratedWidgetAvailable( |
77 gfx::AcceleratedWidget widget) OVERRIDE { | 77 gfx::AcceleratedWidget widget) override { |
78 delegate_->OnAcceleratedWidgetAvailable(widget); | 78 delegate_->OnAcceleratedWidgetAvailable(widget); |
79 } | 79 } |
80 | 80 |
81 virtual void OnActivationChanged(bool active) OVERRIDE {} | 81 virtual void OnActivationChanged(bool active) override {} |
82 | 82 |
83 scoped_ptr<ui::PlatformWindow> platform_window_; | 83 scoped_ptr<ui::PlatformWindow> platform_window_; |
84 Delegate* delegate_; | 84 Delegate* delegate_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(PlatformViewportOzone); | 86 DISALLOW_COPY_AND_ASSIGN(PlatformViewportOzone); |
87 }; | 87 }; |
88 | 88 |
89 // static | 89 // static |
90 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) { | 90 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) { |
91 return scoped_ptr<PlatformViewport>( | 91 return scoped_ptr<PlatformViewport>( |
92 new PlatformViewportOzone(delegate)).Pass(); | 92 new PlatformViewportOzone(delegate)).Pass(); |
93 } | 93 } |
94 | 94 |
95 } // namespace mojo | 95 } // namespace mojo |
OLD | NEW |