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

Side by Side Diff: ui/views/mus/screen_mus.cc

Issue 2505133003: Mojo C++ bindings: switch part of the services/ui/public/interfaces mojom target to use STL types. (Closed)
Patch Set: Merge branch 'master' into c139_wrappers_ui Created 4 years, 1 month 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
« no previous file with comments | « ui/views/mus/screen_mus.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // This has to be before any other includes, else default is picked up. 5 // This has to be before any other includes, else default is picked up.
6 // See base/logging for details on this. 6 // See base/logging for details on this.
7 #define NOTIMPLEMENTED_POLICY 5 7 #define NOTIMPLEMENTED_POLICY 5
8 8
9 #include "ui/views/mus/screen_mus.h" 9 #include "ui/views/mus/screen_mus.h"
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) { 85 bool ScreenMus::IsWindowUnderCursor(gfx::NativeWindow window) {
86 return window && window->IsVisible() && 86 return window && window->IsVisible() &&
87 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); 87 window->GetBoundsInScreen().Contains(GetCursorScreenPoint());
88 } 88 }
89 89
90 aura::Window* ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) { 90 aura::Window* ScreenMus::GetWindowAtScreenPoint(const gfx::Point& point) {
91 return delegate_->GetWindowAtScreenPoint(point); 91 return delegate_->GetWindowAtScreenPoint(point);
92 } 92 }
93 93
94 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays, 94 void ScreenMus::OnDisplays(std::vector<ui::mojom::WsDisplayPtr> ws_displays,
95 int64_t primary_display_id, 95 int64_t primary_display_id,
96 int64_t internal_display_id) { 96 int64_t internal_display_id) {
97 // This should only be called once when ScreenMus is added as an observer. 97 // This should only be called once when ScreenMus is added as an observer.
98 DCHECK(display_list().displays().empty()); 98 DCHECK(display_list().displays().empty());
99 99
100 for (size_t i = 0; i < ws_displays.size(); ++i) { 100 for (size_t i = 0; i < ws_displays.size(); ++i) {
101 const display::Display& display = ws_displays[i]->display; 101 const display::Display& display = ws_displays[i]->display;
102 const bool is_primary = display.id() == primary_display_id; 102 const bool is_primary = display.id() == primary_display_id;
103 display_list().AddDisplay(display, 103 display_list().AddDisplay(display,
104 is_primary ? Type::PRIMARY : Type::NOT_PRIMARY); 104 is_primary ? Type::PRIMARY : Type::NOT_PRIMARY);
105 if (is_primary) { 105 if (is_primary) {
106 // TODO(sky): Make WindowManagerFrameValues per display. 106 // TODO(sky): Make WindowManagerFrameValues per display.
107 WindowManagerFrameValues frame_values = 107 WindowManagerFrameValues frame_values =
108 ws_displays[i] 108 ws_displays[i]
109 ->frame_decoration_values.To<WindowManagerFrameValues>(); 109 ->frame_decoration_values.To<WindowManagerFrameValues>();
110 WindowManagerFrameValues::SetInstance(frame_values); 110 WindowManagerFrameValues::SetInstance(frame_values);
111 } 111 }
112 } 112 }
113 113
114 DCHECK(display_list().GetPrimaryDisplayIterator() != 114 DCHECK(display_list().GetPrimaryDisplayIterator() !=
115 display_list().displays().end()); 115 display_list().displays().end());
116 116
117 if (internal_display_id != display::Display::kInvalidDisplayID) 117 if (internal_display_id != display::Display::kInvalidDisplayID)
118 display::Display::SetInternalDisplayId(internal_display_id); 118 display::Display::SetInternalDisplayId(internal_display_id);
119 119
120 DCHECK(!display_list().displays().empty()); 120 DCHECK(!display_list().displays().empty());
121 } 121 }
122 122
123 void ScreenMus::OnDisplaysChanged( 123 void ScreenMus::OnDisplaysChanged(
124 mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) { 124 std::vector<ui::mojom::WsDisplayPtr> ws_displays) {
125 for (size_t i = 0; i < ws_displays.size(); ++i) { 125 for (size_t i = 0; i < ws_displays.size(); ++i) {
126 const display::Display& display = ws_displays[i]->display; 126 const display::Display& display = ws_displays[i]->display;
127 const bool is_primary = 127 const bool is_primary =
128 display.id() == display_list().GetPrimaryDisplayIterator()->id(); 128 display.id() == display_list().GetPrimaryDisplayIterator()->id();
129 ProcessDisplayChanged(display, is_primary); 129 ProcessDisplayChanged(display, is_primary);
130 if (is_primary) { 130 if (is_primary) {
131 WindowManagerFrameValues frame_values = 131 WindowManagerFrameValues frame_values =
132 ws_displays[i] 132 ws_displays[i]
133 ->frame_decoration_values.To<WindowManagerFrameValues>(); 133 ->frame_decoration_values.To<WindowManagerFrameValues>();
134 WindowManagerFrameValues::SetInstance(frame_values); 134 WindowManagerFrameValues::SetInstance(frame_values);
(...skipping 11 matching lines...) Expand all
146 // TODO(kylechar): DisplayList would need to change to handle having no 146 // TODO(kylechar): DisplayList would need to change to handle having no
147 // primary display. 147 // primary display.
148 if (primary_display_id == display::Display::kInvalidDisplayID) 148 if (primary_display_id == display::Display::kInvalidDisplayID)
149 return; 149 return;
150 150
151 ProcessDisplayChanged(*display_list().FindDisplayById(primary_display_id), 151 ProcessDisplayChanged(*display_list().FindDisplayById(primary_display_id),
152 true); 152 true);
153 } 153 }
154 154
155 } // namespace views 155 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/screen_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698