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

Side by Side Diff: Source/core/html/HTMLVideoElement.cpp

Issue 31203002: Add UseCounters for prefixed HTMLVideoElement APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/page/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 212 }
213 213
214 bool HTMLVideoElement::hasAvailableVideoFrame() const 214 bool HTMLVideoElement::hasAvailableVideoFrame() const
215 { 215 {
216 if (!player()) 216 if (!player())
217 return false; 217 return false;
218 218
219 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu rrentData; 219 return player()->hasVideo() && player()->readyState() >= MediaPlayer::HaveCu rrentData;
220 } 220 }
221 221
222 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& es) 222 void HTMLVideoElement::webkitEnterFullscreen(ExceptionState& es, UseCounter::Fea ture feature)
223 { 223 {
224 UseCounter::count(document(), feature);
225
224 if (isFullscreen()) 226 if (isFullscreen())
225 return; 227 return;
226 228
227 // Generate an exception if this isn't called in response to a user gesture, or if the 229 // Generate an exception if this isn't called in response to a user gesture, or if the
228 // element does not support fullscreen. 230 // element does not support fullscreen.
229 if ((userGestureRequiredForFullscreen() && !UserGestureIndicator::processing UserGesture()) || !supportsFullscreen()) { 231 if ((userGestureRequiredForFullscreen() && !UserGestureIndicator::processing UserGesture()) || !supportsFullscreen()) {
230 es.throwUninformativeAndGenericDOMException(InvalidStateError); 232 es.throwUninformativeAndGenericDOMException(InvalidStateError);
231 return; 233 return;
232 } 234 }
233 235
234 enterFullscreen(); 236 enterFullscreen();
235 } 237 }
236 238
237 void HTMLVideoElement::webkitExitFullscreen() 239 void HTMLVideoElement::webkitExitFullscreen(UseCounter::Feature feature)
238 { 240 {
241 UseCounter::count(document(), feature);
239 if (isFullscreen()) 242 if (isFullscreen())
240 exitFullscreen(); 243 exitFullscreen();
241 } 244 }
242 245
243 bool HTMLVideoElement::webkitSupportsFullscreen() 246 bool HTMLVideoElement::webkitSupportsFullscreen()
244 { 247 {
248 UseCounter::count(document(), UseCounter::PrefixedVideoSupportsFullscreen);
245 return supportsFullscreen(); 249 return supportsFullscreen();
246 } 250 }
247 251
248 bool HTMLVideoElement::webkitDisplayingFullscreen() 252 bool HTMLVideoElement::webkitDisplayingFullscreen()
249 { 253 {
254 UseCounter::count(document(), UseCounter::PrefixedVideoDisplayingFullscreen) ;
250 return isFullscreen(); 255 return isFullscreen();
251 } 256 }
252 257
253 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument) 258 void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument)
254 { 259 {
255 if (m_imageLoader) 260 if (m_imageLoader)
256 m_imageLoader->elementDidMoveToNewDocument(); 261 m_imageLoader->elementDidMoveToNewDocument();
257 HTMLMediaElement::didMoveToNewDocument(oldDocument); 262 HTMLMediaElement::didMoveToNewDocument(oldDocument);
258 } 263 }
259 264
260 unsigned HTMLVideoElement::webkitDecodedFrameCount() const 265 unsigned HTMLVideoElement::webkitDecodedFrameCount() const
261 { 266 {
267 UseCounter::count(document(), UseCounter::PrefixedVideoDecodedFrameCount);
268
262 if (!player()) 269 if (!player())
263 return 0; 270 return 0;
264 271
265 return player()->decodedFrameCount(); 272 return player()->decodedFrameCount();
266 } 273 }
267 274
268 unsigned HTMLVideoElement::webkitDroppedFrameCount() const 275 unsigned HTMLVideoElement::webkitDroppedFrameCount() const
269 { 276 {
277 UseCounter::count(document(), UseCounter::PrefixedVideoDroppedFrameCount);
278
270 if (!player()) 279 if (!player())
271 return 0; 280 return 0;
272 281
273 return player()->droppedFrameCount(); 282 return player()->droppedFrameCount();
274 } 283 }
275 284
276 KURL HTMLVideoElement::posterImageURL() const 285 KURL HTMLVideoElement::posterImageURL() const
277 { 286 {
278 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); 287 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL());
279 if (url.isEmpty()) 288 if (url.isEmpty())
280 return KURL(); 289 return KURL();
281 return document().completeURL(url); 290 return document().completeURL(url);
282 } 291 }
283 292
284 } 293 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.h ('k') | Source/core/page/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698