| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/media_controls/elements/MediaControlOverflowMenuButtonElement.
h" |
| 6 |
| 7 #include "core/InputTypeNames.h" |
| 8 #include "core/events/Event.h" |
| 9 #include "modules/media_controls/MediaControlsImpl.h" |
| 10 #include "public/platform/Platform.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 MediaControlOverflowMenuButtonElement::MediaControlOverflowMenuButtonElement( |
| 15 MediaControlsImpl& media_controls) |
| 16 : MediaControlInputElement(media_controls, kMediaOverflowButton) { |
| 17 EnsureUserAgentShadowRoot(); |
| 18 setType(InputTypeNames::button); |
| 19 SetShadowPseudoId(AtomicString("-internal-media-controls-overflow-button")); |
| 20 SetIsWanted(false); |
| 21 } |
| 22 |
| 23 bool MediaControlOverflowMenuButtonElement::WillRespondToMouseClickEvents() { |
| 24 return true; |
| 25 } |
| 26 |
| 27 void MediaControlOverflowMenuButtonElement::DefaultEventHandler(Event* event) { |
| 28 if (event->type() == EventTypeNames::click) { |
| 29 if (GetMediaControls().OverflowMenuVisible()) { |
| 30 Platform::Current()->RecordAction( |
| 31 UserMetricsAction("Media.Controls.OverflowClose")); |
| 32 } else { |
| 33 Platform::Current()->RecordAction( |
| 34 UserMetricsAction("Media.Controls.OverflowOpen")); |
| 35 } |
| 36 |
| 37 static_cast<MediaControlsImpl&>(GetMediaControls()).ToggleOverflowMenu(); |
| 38 event->SetDefaultHandled(); |
| 39 } |
| 40 |
| 41 MediaControlInputElement::DefaultEventHandler(event); |
| 42 } |
| 43 |
| 44 } // namespace blink |
| OLD | NEW |