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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverflowMenuButtonElement.cpp

Issue 2820633003: Media Controls: move simple buttons to modules/. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698