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

Side by Side Diff: mojo/services/native_viewport/platform_viewport_win.cc

Issue 769173002: Move native_viewport and gles2 service impls to //services (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/native_viewport/platform_viewport.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "ui/gfx/rect.h"
9 #include "ui/platform_window/platform_window_delegate.h"
10 #include "ui/platform_window/win/win_window.h"
11
12 namespace mojo {
13
14 class PlatformViewportWin : public PlatformViewport,
15 public ui::PlatformWindowDelegate {
16 public:
17 explicit PlatformViewportWin(Delegate* delegate)
18 : delegate_(delegate) {
19 }
20
21 virtual ~PlatformViewportWin() {
22 // Destroy the platform-window while |this| is still alive.
23 platform_window_.reset();
24 }
25
26 private:
27 // Overridden from PlatformViewport:
28 virtual void Init(const gfx::Rect& bounds) override {
29 platform_window_.reset(new ui::WinWindow(this, bounds));
30 }
31
32 virtual void Show() override {
33 platform_window_->Show();
34 }
35
36 virtual void Hide() override {
37 platform_window_->Hide();
38 }
39
40 virtual void Close() override {
41 platform_window_->Close();
42 }
43
44 virtual gfx::Size GetSize() override {
45 return platform_window_->GetBounds().size();
46 }
47
48 virtual void SetBounds(const gfx::Rect& bounds) override {
49 platform_window_->SetBounds(bounds);
50 }
51
52 virtual void SetCapture() override {
53 platform_window_->SetCapture();
54 }
55
56 virtual void ReleaseCapture() override {
57 platform_window_->ReleaseCapture();
58 }
59
60 // ui::PlatformWindowDelegate:
61 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override {
62 delegate_->OnBoundsChanged(new_bounds);
63 }
64
65 virtual void OnDamageRect(const gfx::Rect& damaged_region) override {
66 }
67
68 virtual void DispatchEvent(ui::Event* event) override {
69 delegate_->OnEvent(event);
70 }
71
72 virtual void OnCloseRequest() override {
73 platform_window_->Close();
74 }
75
76 virtual void OnClosed() override {
77 delegate_->OnDestroyed();
78 }
79
80 virtual void OnWindowStateChanged(ui::PlatformWindowState state) override {
81 }
82
83 virtual void OnLostCapture() override {
84 }
85
86 virtual void OnAcceleratedWidgetAvailable(
87 gfx::AcceleratedWidget widget) override {
88 delegate_->OnAcceleratedWidgetAvailable(widget);
89 }
90
91 virtual void OnActivationChanged(bool active) override {}
92
93 scoped_ptr<ui::PlatformWindow> platform_window_;
94 Delegate* delegate_;
95
96 DISALLOW_COPY_AND_ASSIGN(PlatformViewportWin);
97 };
98
99 // static
100 scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) {
101 return scoped_ptr<PlatformViewport>(new PlatformViewportWin(delegate)).Pass();
102 }
103
104 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/platform_viewport_stub.cc ('k') | mojo/services/native_viewport/platform_viewport_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698