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; } |
}; |
// ---------------------------- |