OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/glue/webmediaplayer_impl.h" | 5 #include "webkit/glue/webmediaplayer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 case media::PIPELINE_ERROR_INVALID_STATE: | 948 case media::PIPELINE_ERROR_INVALID_STATE: |
949 // Decode error. | 949 // Decode error. |
950 SetNetworkState(WebMediaPlayer::DecodeError); | 950 SetNetworkState(WebMediaPlayer::DecodeError); |
951 break; | 951 break; |
952 } | 952 } |
953 | 953 |
954 // Repaint to trigger UI update. | 954 // Repaint to trigger UI update. |
955 Repaint(); | 955 Repaint(); |
956 } | 956 } |
957 | 957 |
958 void WebMediaPlayerImpl::OnNetworkEvent(PipelineStatus status) { | 958 void WebMediaPlayerImpl::OnNetworkEvent(PipelineStatus status) { |
scherkus (not reviewing)
2011/08/16 18:07:00
hmm.. I wonder if this should trigger a repaint
c
| |
959 DCHECK(MessageLoop::current() == main_loop_); | 959 DCHECK(MessageLoop::current() == main_loop_); |
960 if (status == media::PIPELINE_OK) { | 960 if (status == media::PIPELINE_OK) { |
961 if (pipeline_->IsNetworkActive()) { | 961 if (pipeline_->IsNetworkActive()) |
962 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 962 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
963 } else { | 963 else |
964 // If we are inactive because we just finished receiving all the data, | |
965 // do one final repaint to show final progress. | |
966 if (bytesLoaded() == totalBytes() && | |
967 network_state_ != WebKit::WebMediaPlayer::Idle) { | |
968 Repaint(); | |
969 | |
970 SetNetworkState(WebKit::WebMediaPlayer::Loaded); | |
971 } | |
972 | |
973 SetNetworkState(WebKit::WebMediaPlayer::Idle); | 964 SetNetworkState(WebKit::WebMediaPlayer::Idle); |
974 } | |
975 } | 965 } |
976 } | 966 } |
977 | 967 |
978 void WebMediaPlayerImpl::OnDemuxerOpened() { | 968 void WebMediaPlayerImpl::OnDemuxerOpened() { |
979 DCHECK(MessageLoop::current() == main_loop_); | 969 DCHECK(MessageLoop::current() == main_loop_); |
980 | 970 |
981 // TODO(acolwell): Uncomment once WebKit changes are checked in. | 971 // TODO(acolwell): Uncomment once WebKit changes are checked in. |
982 // https://bugs.webkit.org/show_bug.cgi?id=64731 | 972 // https://bugs.webkit.org/show_bug.cgi?id=64731 |
983 //GetClient()->sourceOpened(); | 973 //GetClient()->sourceOpened(); |
984 } | 974 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 } | 1017 } |
1028 } | 1018 } |
1029 | 1019 |
1030 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 1020 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
1031 DCHECK(MessageLoop::current() == main_loop_); | 1021 DCHECK(MessageLoop::current() == main_loop_); |
1032 DCHECK(client_); | 1022 DCHECK(client_); |
1033 return client_; | 1023 return client_; |
1034 } | 1024 } |
1035 | 1025 |
1036 } // namespace webkit_glue | 1026 } // namespace webkit_glue |
OLD | NEW |