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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h

Issue 2243473002: Adding overflow menu to media player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h b/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h
index 00241eaa3a8da837ba4c7d414a5c48dd5d1ee306..8ba41a078841865e3b2c6569b76baa60c57b6564 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElementTypes.h
@@ -34,6 +34,7 @@
#include "core/html/HTMLDivElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/layout/LayoutBlock.h"
+#include "public/platform/WebLocalizedString.h"
namespace blink {
@@ -67,6 +68,8 @@ enum MediaControlElementType {
MediaCastOnButton,
MediaOverlayCastOffButton,
MediaOverlayCastOnButton,
+ MediaOverflowButton,
+ MediaOverflowList,
};
CORE_EXPORT const HTMLMediaElement* toParentMediaElement(const Node*);
@@ -89,6 +92,21 @@ public:
MediaControlElementType displayType() const { return m_displayType; }
+ // By default, media controls elements are not added to the overflow menu.
+ // Controls that can be added to the overflow menu should override this
+ // function and return true.
+ virtual bool hasOverflowButton() { return false; }
+
+ // If true, shows the overflow menu item if it exists. Hides it if false.
+ void shouldShowButtonInOverflowMenu(bool);
+
+ // Returns a string representation of the media control element. Used for
+ // the overflow menu.
+ String getOverflowMenuString();
+
+ // Updates the value of the Text string shown in the overflow menu.
+ void updateOverflowString();
+
DECLARE_VIRTUAL_TRACE();
protected:
@@ -103,11 +121,29 @@ protected:
void setDisplayType(MediaControlElementType);
+ // Represents the overflow menu element for this media control.
+ // The Element contains the button that the user can click on, but having
+ // the button within an Element enables us to style the overflow menu.
+ // Setting this pointer is optional so it may be null.
+ Member<Element> m_overflowMenuElement;
+
+ // The text representation of the button within the overflow menu.
+ Member<Text> m_overflowMenuText;
+
private:
// Hide or show based on our fits / wanted state. We want to show
// if and only if we're wanted and we fit.
void updateShownState();
+ // Returns a string representation of the media control element.
+ // Subclasses should override this method to return the string representation
+ // of the overflow button.
+ virtual WebLocalizedString::Name getOverflowStringName()
+ {
+ NOTREACHED();
+ return WebLocalizedString::AXAMPMFieldText;
+ }
+
Member<MediaControls> m_mediaControls;
MediaControlElementType m_displayType;
Member<HTMLElement> m_element;
@@ -136,6 +172,9 @@ class MediaControlInputElement : public HTMLInputElement, public MediaControlEle
public:
DECLARE_VIRTUAL_TRACE();
+ // Creates an overflow menu element with the given button as a child.
+ HTMLElement* createOverflowElement(MediaControls&, MediaControlInputElement*);
+
protected:
MediaControlInputElement(MediaControls&, MediaControlElementType);
@@ -143,6 +182,9 @@ private:
virtual void updateDisplayType() { }
bool isMediaControlElement() const final { return true; }
bool isMouseFocusable() const override;
+
+ // Creates an overflow menu HTML element.
+ virtual MediaControlInputElement* createOverflowButton(MediaControls&) { return nullptr; }
};
// ----------------------------

Powered by Google App Engine
This is Rietveld 408576698