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

Side by Side Diff: content/browser/media/session/media_session.cc

Issue 2300083002: Wrap MediaMetadata in base::Optional in content and chrome (Closed)
Patch Set: fix Android build Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/session/media_session.h" 5 #include "content/browser/media/session/media_session.h"
6 6
7 #include "content/browser/media/session/media_session_delegate.h" 7 #include "content/browser/media/session/media_session_delegate.h"
8 #include "content/browser/media/session/media_session_observer.h" 8 #include "content/browser/media/session/media_session_observer.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 session->Initialize(); 53 session->Initialize();
54 } 54 }
55 return session; 55 return session;
56 } 56 }
57 57
58 MediaSession::~MediaSession() { 58 MediaSession::~MediaSession() {
59 DCHECK(players_.empty()); 59 DCHECK(players_.empty());
60 DCHECK(audio_focus_state_ == State::INACTIVE); 60 DCHECK(audio_focus_state_ == State::INACTIVE);
61 } 61 }
62 62
63 void MediaSession::SetMetadata(const MediaMetadata& metadata) { 63 void MediaSession::SetMetadata(const base::Optional<MediaMetadata>& metadata) {
64 metadata_ = metadata; 64 metadata_ = metadata;
65 // TODO(zqzhang): On Android, the metadata is sent though JNI everytime the 65 // TODO(zqzhang): On Android, the metadata is sent though JNI everytime the
66 // media session play/pause state changes. Need to find a way to seprate the 66 // media session play/pause state changes. Need to find a way to seprate the
67 // state change and Metadata update. See https://crbug.com/621855. 67 // state change and Metadata update. See https://crbug.com/621855.
68 static_cast<WebContentsImpl*>(web_contents())->OnMediaSessionStateChanged(); 68 static_cast<WebContentsImpl*>(web_contents())->OnMediaSessionStateChanged();
69 } 69 }
70 70
71 bool MediaSession::AddPlayer(MediaSessionObserver* observer, 71 bool MediaSession::AddPlayer(MediaSessionObserver* observer,
72 int player_id, 72 int player_id,
73 media::MediaContentType media_content_type) { 73 media::MediaContentType media_content_type) {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 case State::SUSPENDED: 383 case State::SUSPENDED:
384 uma_helper_.OnSessionSuspended(); 384 uma_helper_.OnSessionSuspended();
385 break; 385 break;
386 case State::INACTIVE: 386 case State::INACTIVE:
387 uma_helper_.OnSessionInactive(); 387 uma_helper_.OnSessionInactive();
388 break; 388 break;
389 } 389 }
390 } 390 }
391 391
392 } // namespace content 392 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session.h ('k') | content/browser/media/session/media_session_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698