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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 MediaControls::setMediaController(controller); 144 MediaControls::setMediaController(controller);
145 145
146 if (m_durationDisplay) 146 if (m_durationDisplay)
147 m_durationDisplay->setMediaController(controller); 147 m_durationDisplay->setMediaController(controller);
148 if (m_enclosure) 148 if (m_enclosure)
149 m_enclosure->setMediaController(controller); 149 m_enclosure->setMediaController(controller);
150 } 150 }
151 151
152 void MediaControlsChromium::reset() 152 void MediaControlsChromium::reset()
153 { 153 {
154 Page* page = document()->page(); 154 Page* page = document().page();
155 if (!page) 155 if (!page)
156 return; 156 return;
157 157
158 double duration = m_mediaController->duration(); 158 double duration = m_mediaController->duration();
159 m_durationDisplay->setInnerText(RenderTheme::theme().formatMediaControlsTime (duration), ASSERT_NO_EXCEPTION); 159 m_durationDisplay->setInnerText(RenderTheme::theme().formatMediaControlsTime (duration), ASSERT_NO_EXCEPTION);
160 m_durationDisplay->setCurrentValue(duration); 160 m_durationDisplay->setCurrentValue(duration);
161 161
162 MediaControls::reset(); 162 MediaControls::reset();
163 } 163 }
164 164
165 void MediaControlsChromium::playbackStarted() 165 void MediaControlsChromium::playbackStarted()
166 { 166 {
167 m_currentTimeDisplay->show(); 167 m_currentTimeDisplay->show();
168 m_durationDisplay->hide(); 168 m_durationDisplay->hide();
169 169
170 MediaControls::playbackStarted(); 170 MediaControls::playbackStarted();
171 } 171 }
172 172
173 void MediaControlsChromium::updateCurrentTimeDisplay() 173 void MediaControlsChromium::updateCurrentTimeDisplay()
174 { 174 {
175 double now = m_mediaController->currentTime(); 175 double now = m_mediaController->currentTime();
176 double duration = m_mediaController->duration(); 176 double duration = m_mediaController->duration();
177 177
178 Page* page = document()->page(); 178 Page* page = document().page();
179 if (!page) 179 if (!page)
180 return; 180 return;
181 181
182 // After seek, hide duration display and show current time. 182 // After seek, hide duration display and show current time.
183 if (now > 0) { 183 if (now > 0) {
184 m_currentTimeDisplay->show(); 184 m_currentTimeDisplay->show();
185 m_durationDisplay->hide(); 185 m_durationDisplay->hide();
186 } 186 }
187 187
188 // Allow the theme to format the time. 188 // Allow the theme to format the time.
189 m_currentTimeDisplay->setInnerText(RenderTheme::theme().formatMediaControlsC urrentTime(now, duration), IGNORE_EXCEPTION); 189 m_currentTimeDisplay->setInnerText(RenderTheme::theme().formatMediaControlsC urrentTime(now, duration), IGNORE_EXCEPTION);
190 m_currentTimeDisplay->setCurrentValue(now); 190 m_currentTimeDisplay->setCurrentValue(now);
191 } 191 }
192 192
193 void MediaControlsChromium::changedMute() 193 void MediaControlsChromium::changedMute()
194 { 194 {
195 MediaControls::changedMute(); 195 MediaControls::changedMute();
196 196
197 if (m_mediaController->muted()) 197 if (m_mediaController->muted())
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/MediaControls.cpp ('k') | Source/core/html/shadow/PasswordGeneratorButtonElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698