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

Side by Side Diff: third_party/WebKit/Source/core/html/MediaDocument.cpp

Issue 2764673002: Embedded media: Rotate to fullscreen
Patch Set: Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 private: 132 private:
133 MediaLoadedEventListener() : EventListener(CPPEventListenerType) {} 133 MediaLoadedEventListener() : EventListener(CPPEventListenerType) {}
134 134
135 void handleEvent(ExecutionContext* context, Event* event) override { 135 void handleEvent(ExecutionContext* context, Event* event) override {
136 HTMLVideoElement* media = 136 HTMLVideoElement* media =
137 static_cast<HTMLVideoElement*>(event->target()->toNode()); 137 static_cast<HTMLVideoElement*>(event->target()->toNode());
138 UserGestureIndicator gesture( 138 UserGestureIndicator gesture(
139 DocumentUserGestureToken::create(&media->document())); 139 DocumentUserGestureToken::create(&media->document()));
140 // TODO(shaktisahu): Enable fullscreen after https://crbug/698353 is fixed. 140 media->webkitEnterFullscreen();
141 media->play(); 141 media->play();
142 } 142 }
143 }; 143 };
144 144
145 void MediaDocumentParser::createDocumentStructure() { 145 void MediaDocumentParser::createDocumentStructure() {
146 DCHECK(document()); 146 DCHECK(document());
147 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*document()); 147 HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*document());
148 document()->appendChild(rootElement); 148 document()->appendChild(rootElement);
149 rootElement->insertedByParser(); 149 rootElement->insertedByParser();
150 150
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 UseCounter::count(*this, UseCounter::MediaDocument); 269 UseCounter::count(*this, UseCounter::MediaDocument);
270 if (!isInMainFrame()) 270 if (!isInMainFrame())
271 UseCounter::count(*this, UseCounter::MediaDocumentInFrame); 271 UseCounter::count(*this, UseCounter::MediaDocumentInFrame);
272 } 272 }
273 273
274 DocumentParser* MediaDocument::createParser() { 274 DocumentParser* MediaDocument::createParser() {
275 return MediaDocumentParser::create(this); 275 return MediaDocumentParser::create(this);
276 } 276 }
277 277
278 void MediaDocument::defaultEventHandler(Event* event) { 278 void MediaDocument::defaultEventHandler(Event* event) {
279 // VLOG(0) << "shakti, defaultEventHandler " << event->type();
279 Node* targetNode = event->target()->toNode(); 280 Node* targetNode = event->target()->toNode();
280 if (!targetNode) 281 if (!targetNode)
281 return; 282 return;
282 283
283 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { 284 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) {
284 HTMLVideoElement* video = 285 HTMLVideoElement* video =
285 Traversal<HTMLVideoElement>::firstWithin(*targetNode); 286 Traversal<HTMLVideoElement>::firstWithin(*targetNode);
286 if (!video) 287 if (!video)
287 return; 288 return;
288 289
289 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); 290 KeyboardEvent* keyboardEvent = toKeyboardEvent(event);
290 if (keyboardEvent->key() == " " || 291 if (keyboardEvent->key() == " " ||
291 keyboardEvent->keyCode() == VKEY_MEDIA_PLAY_PAUSE) { 292 keyboardEvent->keyCode() == VKEY_MEDIA_PLAY_PAUSE) {
292 // space or media key (play/pause) 293 // space or media key (play/pause)
293 video->togglePlayState(); 294 video->togglePlayState();
294 event->setDefaultHandled(); 295 event->setDefaultHandled();
295 } 296 }
296 } 297 }
297 } 298 }
298 299
299 } // namespace blink 300 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLVideoElement.cpp ('k') | third_party/WebKit/Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698