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

Side by Side Diff: services/ui/display/screen_manager_forwarding.cc

Issue 2901413004: chromeos: Fix handling of null in NativeDisplayDelegate (Closed)
Patch Set: Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/ui/display/screen_manager_forwarding.h" 5 #include "services/ui/display/screen_manager_forwarding.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "services/service_manager/public/cpp/bind_source_info.h" 10 #include "services/service_manager/public/cpp/bind_source_info.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 void ScreenManagerForwarding::GetDisplays(const GetDisplaysCallback& callback) { 111 void ScreenManagerForwarding::GetDisplays(const GetDisplaysCallback& callback) {
112 DCHECK(native_display_delegate_); 112 DCHECK(native_display_delegate_);
113 native_display_delegate_->GetDisplays( 113 native_display_delegate_->GetDisplays(
114 base::Bind(&ScreenManagerForwarding::ForwardGetDisplays, 114 base::Bind(&ScreenManagerForwarding::ForwardGetDisplays,
115 base::Unretained(this), callback)); 115 base::Unretained(this), callback));
116 } 116 }
117 117
118 void ScreenManagerForwarding::Configure( 118 void ScreenManagerForwarding::Configure(
119 int64_t display_id, 119 int64_t display_id,
120 std::unique_ptr<display::DisplayMode> mode, 120 base::Optional<std::unique_ptr<display::DisplayMode>> mode,
121 const gfx::Point& origin, 121 const gfx::Point& origin,
122 const ConfigureCallback& callback) { 122 const ConfigureCallback& callback) {
123 DCHECK(native_display_delegate_); 123 DCHECK(native_display_delegate_);
124 DisplaySnapshot* snapshot = snapshot_map_[display_id]; 124 DisplaySnapshot* snapshot = snapshot_map_[display_id];
125 if (!snapshot) { 125 if (!snapshot) {
126 callback.Run(false); 126 callback.Run(false);
127 return; 127 return;
128 } 128 }
129 129
130 // We need a pointer to the mode in |snapshot|, not the equivalent mode we 130 // We need a pointer to the mode in |snapshot|, not the equivalent mode we
131 // received over Mojo. 131 // received over Mojo.
132 const DisplayMode* snapshot_mode = 132 const DisplayMode* snapshot_mode =
133 GetCorrespondingMode(*snapshot, mode.get()); 133 mode ? GetCorrespondingMode(*snapshot, mode->get()) : nullptr;
134 native_display_delegate_->Configure( 134 native_display_delegate_->Configure(
135 *snapshot, snapshot_mode, origin, 135 *snapshot, snapshot_mode, origin,
136 base::Bind(&ScreenManagerForwarding::ForwardConfigure, 136 base::Bind(&ScreenManagerForwarding::ForwardConfigure,
137 base::Unretained(this), snapshot, snapshot_mode, origin, 137 base::Unretained(this), snapshot, snapshot_mode, origin,
138 callback)); 138 callback));
139 } 139 }
140 140
141 void ScreenManagerForwarding::GetHDCPState( 141 void ScreenManagerForwarding::GetHDCPState(
142 int64_t display_id, 142 int64_t display_id,
143 const GetHDCPStateCallback& callback) { 143 const GetHDCPStateCallback& callback) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (status) { 211 if (status) {
212 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone 212 // Modify display snapshot similar to how ConfigureDisplaysTask would. Ozone
213 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it. 213 // DRM needs these to be changed and ConfigureDisplaysTasks can't do it.
214 snapshot->set_current_mode(mode); 214 snapshot->set_current_mode(mode);
215 snapshot->set_origin(origin); 215 snapshot->set_origin(origin);
216 } 216 }
217 callback.Run(status); 217 callback.Run(status);
218 } 218 }
219 219
220 } // namespace display 220 } // namespace display
OLDNEW
« no previous file with comments | « services/ui/display/screen_manager_forwarding.h ('k') | ui/display/manager/forwarding_display_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698