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

Side by Side Diff: services/native_viewport/ozone/platform_viewport_ozone.cc

Issue 1309273005: native_viewport support for ozone (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 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 unified diff | Download patch
OLDNEW
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 "services/native_viewport/platform_viewport.h" 5 #include "services/native_viewport/platform_viewport.h"
6 6
7 #include "mojo/converters/geometry/geometry_type_converters.h" 7 #include "mojo/converters/geometry/geometry_type_converters.h"
8 #include "mojo/converters/input_events/input_events_type_converters.h" 8 #include "mojo/converters/input_events/input_events_type_converters.h"
9 #include "mojo/converters/input_events/mojo_extended_key_event_data.h" 9 #include "mojo/converters/input_events/mojo_extended_key_event_data.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 platform_window_.reset(); 43 platform_window_.reset();
44 } 44 }
45 45
46 private: 46 private:
47 // Overridden from PlatformViewport: 47 // Overridden from PlatformViewport:
48 void Init(const gfx::Rect& bounds) override { 48 void Init(const gfx::Rect& bounds) override {
49 platform_window_ = 49 platform_window_ =
50 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); 50 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
51 51
52 metrics_ = mojo::ViewportMetrics::New(); 52 metrics_ = mojo::ViewportMetrics::New();
53 metrics_->size = mojo::Size::From(bounds.size()); 53 metrics_->size = mojo::Size::From(platform_window_->GetBounds().size());
54 } 54 }
55 55
56 void Show() override { platform_window_->Show(); } 56 void Show() override { platform_window_->Show(); }
57 57
58 void Hide() override { platform_window_->Hide(); } 58 void Hide() override { platform_window_->Hide(); }
59 59
60 void Close() override { platform_window_->Close(); } 60 void Close() override { platform_window_->Close(); }
61 61
62 gfx::Size GetSize() override { 62 gfx::Size GetSize() override { return platform_window_->GetBounds().size(); }
63 return platform_window_->GetBounds().size();
64 }
65 63
66 void SetBounds(const gfx::Rect& bounds) override { 64 void SetBounds(const gfx::Rect& bounds) override {
67 platform_window_->SetBounds(bounds); 65 platform_window_->SetBounds(bounds);
68 } 66 }
69 67
70 // ui::PlatformWindowDelegate: 68 // ui::PlatformWindowDelegate:
71 void OnBoundsChanged(const gfx::Rect& new_bounds) override { 69 void OnBoundsChanged(const gfx::Rect& new_bounds) override {
72 metrics_->size = mojo::Size::From(new_bounds.size()); 70 metrics_->size = mojo::Size::From(new_bounds.size());
73 delegate_->OnMetricsChanged(metrics_.Clone()); 71 delegate_->OnMetricsChanged(metrics_.Clone());
74 } 72 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Delegate* delegate_; 120 Delegate* delegate_;
123 mojo::ViewportMetricsPtr metrics_; 121 mojo::ViewportMetricsPtr metrics_;
124 122
125 DISALLOW_COPY_AND_ASSIGN(PlatformViewportOzone); 123 DISALLOW_COPY_AND_ASSIGN(PlatformViewportOzone);
126 }; 124 };
127 125
128 // static 126 // static
129 scoped_ptr<PlatformViewport> PlatformViewport::Create( 127 scoped_ptr<PlatformViewport> PlatformViewport::Create(
130 mojo::ApplicationImpl* application_, 128 mojo::ApplicationImpl* application_,
131 Delegate* delegate) { 129 Delegate* delegate) {
132 return scoped_ptr<PlatformViewport>( 130 return scoped_ptr<PlatformViewport>(new PlatformViewportOzone(delegate))
133 new PlatformViewportOzone(delegate)).Pass(); 131 .Pass();
134 } 132 }
135 133
136 } // namespace native_viewport 134 } // namespace native_viewport
OLDNEW
« no previous file with comments | « services/native_viewport/ozone/display_manager.cc ('k') | services/native_viewport/platform_viewport_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698