diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 19 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 91 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 13 | ||||
-rw-r--r-- | webkit/glue/context_menu.h | 14 | ||||
-rw-r--r-- | webkit/glue/context_menu_client_impl.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 4 |
6 files changed, 6 insertions, 139 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index c7a9e3e..3974b03 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -392,25 +392,6 @@ each locale. --> Open &image in new tab </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_MENU" desc="The text label of the Playback Rate submenu"> - &Playback Rate - </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW" desc="The text label of the 0.5x Speed Playback Rate menu item. The slowest of 5 options."> - &Slow (0.5x) - </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL" desc="The text label of the Normal Speed Playback Rate menu item. The default rate of 5 options."> - &Normal (1.0x) - </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST" desc="The text label of the 1.25x Sped Up Playback Rate menu item. The 3rd fastest of 5 options."> - &Fast (1.25x) - </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER" desc="The text label of the 1.5x Sped Up Playback Rate menu item. The 2nd fastest of 5 options."> - F&aster (1.5x) - </message> - <message name="IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME" desc="The text label of the 2.0x Sped Up Playback Rate menu item. The fastest of 5 options."> - D&ouble Time (2.0x) - </message> - <message name="IDS_CONTENT_CONTEXT_LOOP" desc="The name of the Loop command for audio and video playback in the content area context menu"> &Loop </message> diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 8aa9beb..40cc054 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -29,15 +29,6 @@ #include "net/base/escape.h" #include "net/base/net_util.h" -// Constants for the standard playback rates provided by the context -// menu. If another rate is reported, it will be considered unknown and -// no rate will be selected in the submenu. -static const double kSlowPlaybackRate = 0.5f; -static const double kNormalPlaybackRate = 1.0f; -static const double kFastPlaybackRate = 1.25f; -static const double kFasterPlaybackRate = 1.50f; -static const double kDoubleTimePlaybackRate = 2.0f; - RenderViewContextMenu::RenderViewContextMenu( TabContents* tab_contents, const ContextMenuParams& params) @@ -155,20 +146,6 @@ void RenderViewContextMenu::AppendMediaItems( AppendCheckboxMenuItem(IDS_CONTENT_CONTEXT_LOOP, l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_LOOP)); - - StartSubMenu(IDS_CONTENT_CONTEXT_PLAYBACKRATE_MENU, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_MENU)); - AppendRadioMenuItem(IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW)); - AppendRadioMenuItem(IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL)); - AppendRadioMenuItem(IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST)); - AppendRadioMenuItem(IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER)); - AppendRadioMenuItem(IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME, - l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME)); - FinishSubMenu(); } void RenderViewContextMenu::AppendPageItems() { @@ -342,12 +319,6 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { case IDS_CONTENT_CONTEXT_MUTE: case IDS_CONTENT_CONTEXT_UNMUTE: case IDS_CONTENT_CONTEXT_LOOP: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_MENU: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER: - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME: return (params_.media_params.player_state & ContextMenuMediaParams::IN_ERROR) == 0; @@ -435,23 +406,6 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const { } bool RenderViewContextMenu::ItemIsChecked(int id) const { - // Select the correct playback rate. - if (id == IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW) { - return params_.media_params.playback_rate == kSlowPlaybackRate; - } - if (id == IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL) { - return params_.media_params.playback_rate == kNormalPlaybackRate; - } - if (id == IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST) { - return params_.media_params.playback_rate == kFastPlaybackRate; - } - if (id == IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER) { - return params_.media_params.playback_rate == kFasterPlaybackRate; - } - if (id == IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME) { - return params_.media_params.playback_rate == kDoubleTimePlaybackRate; - } - // See if the video is set to looping. if (id == IDS_CONTENT_CONTEXT_LOOP) { return (params_.media_params.player_state & @@ -581,51 +535,6 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) { } break; - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_SLOW: - UserMetrics::RecordAction(L"MediaContextMenu_RateSlow", profile_); - MediaPlayerActionAt( - params_.x, - params_.y, - MediaPlayerAction(MediaPlayerAction::SET_PLAYBACK_RATE, - kSlowPlaybackRate)); - break; - - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_NORMAL: - UserMetrics::RecordAction(L"MediaContextMenu_RateNormal", profile_); - MediaPlayerActionAt( - params_.x, - params_.y, - MediaPlayerAction(MediaPlayerAction::SET_PLAYBACK_RATE, - kNormalPlaybackRate)); - break; - - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_FAST: - UserMetrics::RecordAction(L"MediaContextMenu_RateFast", profile_); - MediaPlayerActionAt( - params_.x, - params_.y, - MediaPlayerAction(MediaPlayerAction::SET_PLAYBACK_RATE, - kFastPlaybackRate)); - break; - - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_FASTER: - UserMetrics::RecordAction(L"MediaContextMenu_RateFaster", profile_); - MediaPlayerActionAt( - params_.x, - params_.y, - MediaPlayerAction(MediaPlayerAction::SET_PLAYBACK_RATE, - kFasterPlaybackRate)); - break; - - case IDS_CONTENT_CONTEXT_PLAYBACKRATE_DOUBLETIME: - UserMetrics::RecordAction(L"MediaContextMenu_RateDoubleTime", profile_); - MediaPlayerActionAt( - params_.x, - params_.y, - MediaPlayerAction(MediaPlayerAction::SET_PLAYBACK_RATE, - kDoubleTimePlaybackRate)); - break; - case IDS_CONTENT_CONTEXT_BACK: source_tab_contents_->controller().GoBack(); break; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index fefa3ac..f16957c7 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -876,12 +876,10 @@ struct ParamTraits<ContextMenuMediaParams> { typedef ContextMenuMediaParams param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.player_state); - WriteParam(m, p.playback_rate); } static bool Read(const Message* m, void** iter, param_type* p) { return - ReadParam(m, iter, &p->player_state) && - ReadParam(m, iter, &p->playback_rate); + ReadParam(m, iter, &p->player_state); } }; @@ -935,12 +933,10 @@ struct ParamTraits<MediaPlayerAction> { typedef MediaPlayerAction param_type; static void Write(Message* m, const param_type& p) { WriteParam(m, p.command); - WriteParam(m, p.playback_rate); } static bool Read(const Message* m, void** iter, param_type* p) { return - ReadParam(m, iter, &p->command) && - ReadParam(m, iter, &p->playback_rate); + ReadParam(m, iter, &p->command); } static void Log(const param_type& p, std::wstring* l) { std::wstring event = L""; @@ -960,11 +956,6 @@ struct ParamTraits<MediaPlayerAction> { l->append(L"LOOP|"); if (p.command & MediaPlayerAction::NO_LOOP) l->append(L"NO_LOOP|"); - if (p.command & MediaPlayerAction::SET_PLAYBACK_RATE) { - l->append(L"SET_PLAYBACK_RATE ["); - LogParam(p.playback_rate, l); - l->append(L"]|"); - } l->append(L")"); } } diff --git a/webkit/glue/context_menu.h b/webkit/glue/context_menu.h index 620338a..975ad275 100644 --- a/webkit/glue/context_menu.h +++ b/webkit/glue/context_menu.h @@ -82,11 +82,8 @@ struct ContextMenuMediaParams { // playing, muted, etc. int32 player_state; - // The current playback rate for this media element. - double playback_rate; - ContextMenuMediaParams() - : player_state(NO_STATE), playback_rate(1.0f) { + : player_state(NO_STATE) { } }; @@ -166,19 +163,14 @@ struct MediaPlayerAction { UNMUTE = 0x8, LOOP = 0x10, NO_LOOP = 0x20, - SET_PLAYBACK_RATE = 0x40, }; // A bitfield representing the actions that the context menu should execute // on the originating node. int32 command; - // The new playback rate to set if the action is SET_PLAYBACK_RATE. - double playback_rate; - - MediaPlayerAction() : command(NONE), playback_rate(1.0f) {} - explicit MediaPlayerAction(int c) : command(c), playback_rate(1.0f) {} - MediaPlayerAction(int c, double rate) : command(c), playback_rate(rate) {} + MediaPlayerAction() : command(NONE) {} + explicit MediaPlayerAction(int c) : command(c) {} }; #endif // WEBKIT_GLUE_CONTEXT_NODE_TYPES_H__ diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc index 210fb24..5ad232d 100644 --- a/webkit/glue/context_menu_client_impl.cc +++ b/webkit/glue/context_menu_client_impl.cc @@ -180,7 +180,7 @@ WebCore::PlatformMenuDescription node_type.type |= ContextNodeType::IMAGE; } else if (!r.absoluteMediaURL().isEmpty()) { src_url = r.absoluteMediaURL(); - + // We know that if absoluteMediaURL() is not empty, then this is a media // element. WebCore::HTMLMediaElement* media_element = @@ -191,8 +191,6 @@ WebCore::PlatformMenuDescription node_type.type |= ContextNodeType::AUDIO; } - media_params.playback_rate = media_element->playbackRate(); - if (media_element->paused()) { media_params.player_state |= ContextMenuMediaParams::PAUSED; } diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 2a646e8..6d8f05a 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1820,10 +1820,6 @@ void WebViewImpl::MediaPlayerActionAt(int x, if (action.command & MediaPlayerAction::NO_LOOP) { media_element->setLoop(false); } - if (action.command & MediaPlayerAction::SET_PLAYBACK_RATE) { - // TODO(ajwong): We should test for overflow. - media_element->setPlaybackRate(static_cast<float>(action.playback_rate)); - } } } |