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

Side by Side Diff: webkit/glue/context_menu_client_impl.cc

Issue 174119: Disable playback controls if audio/video element has errored. (Closed)
Patch Set: Created 11 years, 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "config.h" 5 #include "config.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 MSVC_PUSH_WARNING_LEVEL(0); 9 MSVC_PUSH_WARNING_LEVEL(0);
10 #include "ContextMenu.h" 10 #include "ContextMenu.h"
11 #include "Document.h" 11 #include "Document.h"
12 #include "DocumentLoader.h" 12 #include "DocumentLoader.h"
13 #include "Editor.h" 13 #include "Editor.h"
14 #include "EventHandler.h" 14 #include "EventHandler.h"
15 #include "FrameLoader.h" 15 #include "FrameLoader.h"
16 #include "FrameView.h" 16 #include "FrameView.h"
17 #include "HitTestResult.h" 17 #include "HitTestResult.h"
18 #include "HTMLMediaElement.h" 18 #include "HTMLMediaElement.h"
19 #include "HTMLNames.h" 19 #include "HTMLNames.h"
20 #include "KURL.h" 20 #include "KURL.h"
21 #include "MediaError.h"
awong 2009/08/20 18:33:54 Do you need to include MediaError?
scherkus (not reviewing) 2009/08/20 18:50:24 HTMLMediaElement::error() returns PassRefPtr<Media
awong 2009/08/20 18:57:52 Ah...makes sense. <insert grumbling about making
21 #include "Widget.h" 22 #include "Widget.h"
22 MSVC_POP_WARNING(); 23 MSVC_POP_WARNING();
23 #undef LOG 24 #undef LOG
24 25
25 #include "webkit/glue/context_menu_client_impl.h" 26 #include "webkit/glue/context_menu_client_impl.h"
26 27
27 #include "base/string_util.h" 28 #include "base/string_util.h"
28 #include "webkit/api/public/WebURL.h" 29 #include "webkit/api/public/WebURL.h"
29 #include "webkit/api/public/WebURLResponse.h" 30 #include "webkit/api/public/WebURLResponse.h"
30 #include "webkit/glue/context_menu.h" 31 #include "webkit/glue/context_menu.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // We know that if absoluteMediaURL() is not empty, then this is a media 185 // We know that if absoluteMediaURL() is not empty, then this is a media
185 // element. 186 // element.
186 WebCore::HTMLMediaElement* media_element = 187 WebCore::HTMLMediaElement* media_element =
187 static_cast<WebCore::HTMLMediaElement*>(r.innerNonSharedNode()); 188 static_cast<WebCore::HTMLMediaElement*>(r.innerNonSharedNode());
188 if (media_element->hasTagName(WebCore::HTMLNames::videoTag)) { 189 if (media_element->hasTagName(WebCore::HTMLNames::videoTag)) {
189 node_type.type |= ContextNodeType::VIDEO; 190 node_type.type |= ContextNodeType::VIDEO;
190 } else if (media_element->hasTagName(WebCore::HTMLNames::audioTag)) { 191 } else if (media_element->hasTagName(WebCore::HTMLNames::audioTag)) {
191 node_type.type |= ContextNodeType::AUDIO; 192 node_type.type |= ContextNodeType::AUDIO;
192 } 193 }
193 194
195 if (media_element->error()) {
196 media_params.player_state |= ContextMenuMediaParams::IN_ERROR;
197 }
194 if (media_element->paused()) { 198 if (media_element->paused()) {
195 media_params.player_state |= ContextMenuMediaParams::PAUSED; 199 media_params.player_state |= ContextMenuMediaParams::PAUSED;
196 } 200 }
197 if (media_element->muted()) { 201 if (media_element->muted()) {
198 media_params.player_state |= ContextMenuMediaParams::MUTED; 202 media_params.player_state |= ContextMenuMediaParams::MUTED;
199 } 203 }
200 if (media_element->loop()) { 204 if (media_element->loop()) {
201 media_params.player_state |= ContextMenuMediaParams::LOOP; 205 media_params.player_state |= ContextMenuMediaParams::LOOP;
202 } 206 }
203 if (media_element->supportsSave()) { 207 if (media_element->supportsSave()) {
204 media_params.player_state |= ContextMenuMediaParams::CAN_SAVE; 208 media_params.player_state |= ContextMenuMediaParams::CAN_SAVE;
205 } 209 }
206 // TODO(ajwong): Report error states in the media player.
207 } 210 }
208 211
209 // If it's not a link, an image, a media element, or an image/media link, 212 // If it's not a link, an image, a media element, or an image/media link,
210 // show a selection menu or a more generic page menu. 213 // show a selection menu or a more generic page menu.
211 std::wstring selection_text_string; 214 std::wstring selection_text_string;
212 std::wstring misspelled_word_string; 215 std::wstring misspelled_word_string;
213 GURL frame_url; 216 GURL frame_url;
214 GURL page_url; 217 GURL page_url;
215 std::string security_info; 218 std::string security_info;
216 219
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 326
324 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() { 327 bool ContextMenuClientImpl::shouldIncludeInspectElementItem() {
325 return false; // TODO(jackson): Eventually include the inspector context me nu item 328 return false; // TODO(jackson): Eventually include the inspector context me nu item
326 } 329 }
327 330
328 #if defined(OS_MACOSX) 331 #if defined(OS_MACOSX)
329 void ContextMenuClientImpl::searchWithSpotlight() { 332 void ContextMenuClientImpl::searchWithSpotlight() {
330 // TODO(pinkerton): write this 333 // TODO(pinkerton): write this
331 } 334 }
332 #endif 335 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698