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

Side by Side Diff: content/browser/media/media_web_contents_observer.cc

Issue 2921823002: Rationalize WakeLock naming conventions (Closed)
Patch Set: rebase 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 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 "content/browser/media/media_web_contents_observer.h" 5 #include "content/browser/media/media_web_contents_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/media/audible_metrics.h" 10 #include "content/browser/media/audible_metrics.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Notify all observers the player has been "paused". 215 // Notify all observers the player has been "paused".
216 WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents()); 216 WebContentsImpl* wci = static_cast<WebContentsImpl*>(web_contents());
217 for (const auto& id : removed_players) { 217 for (const auto& id : removed_players) {
218 auto it = video_players.find(id); 218 auto it = video_players.find(id);
219 bool was_video = (it != video_players.end()); 219 bool was_video = (it != video_players.end());
220 wci->MediaStoppedPlaying(WebContentsObserver::MediaPlayerInfo(was_video), 220 wci->MediaStoppedPlaying(WebContentsObserver::MediaPlayerInfo(was_video),
221 id); 221 id);
222 } 222 }
223 } 223 }
224 224
225 device::mojom::WakeLockService* MediaWebContentsObserver::GetAudioWakeLock() { 225 device::mojom::WakeLock* MediaWebContentsObserver::GetAudioWakeLock() {
226 // Here is a lazy binding, and will not reconnect after connection error. 226 // Here is a lazy binding, and will not reconnect after connection error.
227 if (!audio_wake_lock_) { 227 if (!audio_wake_lock_) {
228 device::mojom::WakeLockServiceRequest request = 228 device::mojom::WakeLockRequest request =
229 mojo::MakeRequest(&audio_wake_lock_); 229 mojo::MakeRequest(&audio_wake_lock_);
230 device::mojom::WakeLockContext* wake_lock_context = 230 device::mojom::WakeLockContext* wake_lock_context =
231 web_contents()->GetWakeLockContext(); 231 web_contents()->GetWakeLockContext();
232 if (wake_lock_context) { 232 if (wake_lock_context) {
233 wake_lock_context->GetWakeLock( 233 wake_lock_context->GetWakeLock(
234 device::mojom::WakeLockType::PreventAppSuspension, 234 device::mojom::WakeLockType::PreventAppSuspension,
235 device::mojom::WakeLockReason::ReasonAudioPlayback, "Playing audio", 235 device::mojom::WakeLockReason::ReasonAudioPlayback, "Playing audio",
236 std::move(request)); 236 std::move(request));
237 } 237 }
238 } 238 }
239 return audio_wake_lock_.get(); 239 return audio_wake_lock_.get();
240 } 240 }
241 241
242 device::mojom::WakeLockService* MediaWebContentsObserver::GetVideoWakeLock() { 242 device::mojom::WakeLock* MediaWebContentsObserver::GetVideoWakeLock() {
243 // Here is a lazy binding, and will not reconnect after connection error. 243 // Here is a lazy binding, and will not reconnect after connection error.
244 if (!video_wake_lock_) { 244 if (!video_wake_lock_) {
245 device::mojom::WakeLockServiceRequest request = 245 device::mojom::WakeLockRequest request =
246 mojo::MakeRequest(&video_wake_lock_); 246 mojo::MakeRequest(&video_wake_lock_);
247 device::mojom::WakeLockContext* wake_lock_context = 247 device::mojom::WakeLockContext* wake_lock_context =
248 web_contents()->GetWakeLockContext(); 248 web_contents()->GetWakeLockContext();
249 if (wake_lock_context) { 249 if (wake_lock_context) {
250 wake_lock_context->GetWakeLock( 250 wake_lock_context->GetWakeLock(
251 device::mojom::WakeLockType::PreventDisplaySleep, 251 device::mojom::WakeLockType::PreventDisplaySleep,
252 device::mojom::WakeLockReason::ReasonVideoPlayback, "Playing video", 252 device::mojom::WakeLockReason::ReasonVideoPlayback, "Playing video",
253 std::move(request)); 253 std::move(request));
254 } 254 }
255 } 255 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 if (it == player_map->end()) 316 if (it == player_map->end())
317 return; 317 return;
318 318
319 for (int delegate_id : it->second) 319 for (int delegate_id : it->second)
320 removed_players->insert(MediaPlayerId(render_frame_host, delegate_id)); 320 removed_players->insert(MediaPlayerId(render_frame_host, delegate_id));
321 321
322 player_map->erase(it); 322 player_map->erase(it);
323 } 323 }
324 324
325 } // namespace content 325 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_web_contents_observer.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698