OLD | NEW |
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 "content/browser/android/content_video_view.h" | 5 #include "content/browser/android/content_video_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void ContentVideoView::UpdateMediaMetadata() { | 120 void ContentVideoView::UpdateMediaMetadata() { |
121 JNIEnv* env = AttachCurrentThread(); | 121 JNIEnv* env = AttachCurrentThread(); |
122 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); | 122 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); |
123 if (content_video_view.is_null()) | 123 if (content_video_view.is_null()) |
124 return; | 124 return; |
125 | 125 |
126 media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); | 126 media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); |
127 if (player && player->IsPlayerReady()) { | 127 if (player && player->IsPlayerReady()) { |
128 Java_ContentVideoView_onUpdateMediaMetadata( | 128 Java_ContentVideoView_onUpdateMediaMetadata( |
129 env, content_video_view.obj(), player->GetVideoWidth(), | 129 env, content_video_view.obj(), player->GetVideoWidth(), |
130 player->GetVideoHeight(), player->GetDuration().InMilliseconds(), | 130 player->GetVideoHeight(), |
| 131 static_cast<int>(player->GetDuration().InMilliseconds()), |
131 player->CanPause(),player->CanSeekForward(), player->CanSeekBackward()); | 132 player->CanPause(),player->CanSeekForward(), player->CanSeekBackward()); |
132 } | 133 } |
133 } | 134 } |
134 | 135 |
135 int ContentVideoView::GetVideoWidth(JNIEnv*, jobject obj) const { | 136 int ContentVideoView::GetVideoWidth(JNIEnv*, jobject obj) const { |
136 media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); | 137 media::MediaPlayerAndroid* player = manager_->GetFullscreenPlayer(); |
137 return player ? player->GetVideoWidth() : 0; | 138 return player ? player->GetVideoWidth() : 0; |
138 } | 139 } |
139 | 140 |
140 int ContentVideoView::GetVideoHeight(JNIEnv*, jobject obj) const { | 141 int ContentVideoView::GetVideoHeight(JNIEnv*, jobject obj) const { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 231 |
231 if (power_save_blocker_) return; | 232 if (power_save_blocker_) return; |
232 | 233 |
233 power_save_blocker_ = PowerSaveBlocker::Create( | 234 power_save_blocker_ = PowerSaveBlocker::Create( |
234 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 235 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
235 "Playing video").Pass(); | 236 "Playing video").Pass(); |
236 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> | 237 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> |
237 InitDisplaySleepBlocker(GetNativeView()); | 238 InitDisplaySleepBlocker(GetNativeView()); |
238 } | 239 } |
239 } // namespace content | 240 } // namespace content |
OLD | NEW |