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

Side by Side Diff: Source/core/html/shadow/MediaControlsChromium.cpp

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 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 | Annotate | Revision Log
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 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/html/shadow/MediaControlsChromium.h" 28 #include "core/html/shadow/MediaControlsChromium.h"
29 29
30 #include "bindings/v8/ExceptionState.h" 30 #include "bindings/v8/ExceptionState.h"
31 #include "bindings/v8/ExceptionStatePlaceholder.h" 31 #include "bindings/v8/ExceptionStatePlaceholder.h"
32 32
33 using namespace std; 33 using namespace std;
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 MediaControlsChromium::MediaControlsChromium(Document* document) 37 MediaControlsChromium::MediaControlsChromium(Document& document)
38 : MediaControls(document) 38 : MediaControls(document)
39 , m_durationDisplay(0) 39 , m_durationDisplay(0)
40 , m_enclosure(0) 40 , m_enclosure(0)
41 { 41 {
42 } 42 }
43 43
44 // MediaControls::create() for Android is defined in MediaControlsChromiumAndroi d.cpp. 44 // MediaControls::create() for Android is defined in MediaControlsChromiumAndroi d.cpp.
45 #if !OS(ANDROID) 45 #if !OS(ANDROID)
46 PassRefPtr<MediaControls> MediaControls::create(Document* document) 46 PassRefPtr<MediaControls> MediaControls::create(Document& document)
47 { 47 {
48 return MediaControlsChromium::createControls(document); 48 return MediaControlsChromium::createControls(document);
49 } 49 }
50 #endif 50 #endif
51 51
52 PassRefPtr<MediaControlsChromium> MediaControlsChromium::createControls(Document * document) 52 PassRefPtr<MediaControlsChromium> MediaControlsChromium::createControls(Document & document)
53 { 53 {
54 if (!document->page()) 54 if (!document.page())
55 return 0; 55 return 0;
56 56
57 RefPtr<MediaControlsChromium> controls = adoptRef(new MediaControlsChromium( document)); 57 RefPtr<MediaControlsChromium> controls = adoptRef(new MediaControlsChromium( document));
58 58
59 if (controls->initializeControls(document)) 59 if (controls->initializeControls(document))
60 return controls.release(); 60 return controls.release();
61 61
62 return 0; 62 return 0;
63 } 63 }
64 64
65 bool MediaControlsChromium::initializeControls(Document* document) 65 bool MediaControlsChromium::initializeControls(Document& document)
66 { 66 {
67 // Create an enclosing element for the panel so we can visually offset the c ontrols correctly. 67 // Create an enclosing element for the panel so we can visually offset the c ontrols correctly.
68 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo sureElement::create(document); 68 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo sureElement::create(document);
69 69
70 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(do cument); 70 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(do cument);
71 71
72 TrackExceptionState es; 72 TrackExceptionState es;
73 73
74 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle ment::create(document); 74 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle ment::create(document);
75 m_playButton = playButton.get(); 75 m_playButton = playButton.get();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 m_volumeSlider->setVolume(0); 198 m_volumeSlider->setVolume(0);
199 else 199 else
200 m_volumeSlider->setVolume(m_mediaController->volume()); 200 m_volumeSlider->setVolume(m_mediaController->volume());
201 } 201 }
202 202
203 void MediaControlsChromium::createTextTrackDisplay() 203 void MediaControlsChromium::createTextTrackDisplay()
204 { 204 {
205 if (m_textDisplayContainer) 205 if (m_textDisplayContainer)
206 return; 206 return;
207 207
208 RefPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaCo ntrolTextTrackContainerElement::create(&document()); 208 RefPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaCo ntrolTextTrackContainerElement::create(document());
209 m_textDisplayContainer = textDisplayContainer.get(); 209 m_textDisplayContainer = textDisplayContainer.get();
210 210
211 if (m_mediaController) 211 if (m_mediaController)
212 m_textDisplayContainer->setMediaController(m_mediaController); 212 m_textDisplayContainer->setMediaController(m_mediaController);
213 213
214 insertTextTrackContainer(textDisplayContainer.release()); 214 insertTextTrackContainer(textDisplayContainer.release());
215 } 215 }
216 216
217 void MediaControlsChromium::insertTextTrackContainer(PassRefPtr<MediaControlText TrackContainerElement> textTrackContainer) 217 void MediaControlsChromium::insertTextTrackContainer(PassRefPtr<MediaControlText TrackContainerElement> textTrackContainer)
218 { 218 {
219 // Insert it before the first controller element so it always displays behin d the controls. 219 // Insert it before the first controller element so it always displays behin d the controls.
220 // In the Chromium case, that's the enclosure element. 220 // In the Chromium case, that's the enclosure element.
221 insertBefore(textTrackContainer, m_enclosure); 221 insertBefore(textTrackContainer, m_enclosure);
222 } 222 }
223 223
224 224
225 } 225 }
OLDNEW
« no previous file with comments | « Source/core/html/shadow/MediaControlsChromium.h ('k') | Source/core/html/shadow/MediaControlsChromiumAndroid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698