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

Side by Side Diff: media/base/android/media_player_bridge.cc

Issue 1110833004: Move audio focus control from media/ to content/ and make it per WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments and compile Created 5 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/android/media_player_bridge.h" 5 #include "media/base/android/media_player_bridge.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ScopedJavaLocalRef<jobject> allowedOperations = GetAllowedOperations(); 449 ScopedJavaLocalRef<jobject> allowedOperations = GetAllowedOperations();
450 450
451 can_pause_ = Java_AllowedOperations_canPause(env, allowedOperations.obj()); 451 can_pause_ = Java_AllowedOperations_canPause(env, allowedOperations.obj());
452 can_seek_forward_ = Java_AllowedOperations_canSeekForward( 452 can_seek_forward_ = Java_AllowedOperations_canSeekForward(
453 env, allowedOperations.obj()); 453 env, allowedOperations.obj());
454 can_seek_backward_ = Java_AllowedOperations_canSeekBackward( 454 can_seek_backward_ = Java_AllowedOperations_canSeekBackward(
455 env, allowedOperations.obj()); 455 env, allowedOperations.obj());
456 } 456 }
457 457
458 void MediaPlayerBridge::StartInternal() { 458 void MediaPlayerBridge::StartInternal() {
459 if (!manager()->RequestPlay(player_id())) {
460 Pause(true);
qinmin 2015/05/23 18:16:06 this should be false, see my comments in media_sou
461 return;
462 }
463
459 JNIEnv* env = base::android::AttachCurrentThread(); 464 JNIEnv* env = base::android::AttachCurrentThread();
460 Java_MediaPlayerBridge_start(env, j_media_player_bridge_.obj()); 465 Java_MediaPlayerBridge_start(env, j_media_player_bridge_.obj());
461 if (!time_update_timer_.IsRunning()) { 466 if (!time_update_timer_.IsRunning()) {
462 time_update_timer_.Start( 467 time_update_timer_.Start(
463 FROM_HERE, 468 FROM_HERE,
464 base::TimeDelta::FromMilliseconds(kTimeUpdateInterval), 469 base::TimeDelta::FromMilliseconds(kTimeUpdateInterval),
465 this, &MediaPlayerBridge::OnTimeUpdateTimerFired); 470 this, &MediaPlayerBridge::OnTimeUpdateTimerFired);
466 } 471 }
467 472
468 SetAudible(volume_ > 0); 473 SetAudible(volume_ > 0);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 530
526 GURL MediaPlayerBridge::GetUrl() { 531 GURL MediaPlayerBridge::GetUrl() {
527 return url_; 532 return url_;
528 } 533 }
529 534
530 GURL MediaPlayerBridge::GetFirstPartyForCookies() { 535 GURL MediaPlayerBridge::GetFirstPartyForCookies() {
531 return first_party_for_cookies_; 536 return first_party_for_cookies_;
532 } 537 }
533 538
534 } // namespace media 539 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698