| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/media_controls/elements/MediaControlCastButtonElement.h" | 5 #include "modules/media_controls/elements/MediaControlCastButtonElement.h" |
| 6 | 6 |
| 7 #include "core/InputTypeNames.h" | 7 #include "core/InputTypeNames.h" |
| 8 #include "core/dom/ClientRect.h" | |
| 9 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
| 9 #include "core/geometry/DOMRect.h" |
| 10 #include "core/html/HTMLMediaElement.h" | 10 #include "core/html/HTMLMediaElement.h" |
| 11 #include "modules/media_controls/MediaControlsImpl.h" | 11 #include "modules/media_controls/MediaControlsImpl.h" |
| 12 #include "modules/media_controls/elements/MediaControlElementsHelper.h" | 12 #include "modules/media_controls/elements/MediaControlElementsHelper.h" |
| 13 #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" | 13 #include "modules/remoteplayback/HTMLMediaElementRemotePlayback.h" |
| 14 #include "modules/remoteplayback/RemotePlayback.h" | 14 #include "modules/remoteplayback/RemotePlayback.h" |
| 15 #include "platform/Histogram.h" | 15 #include "platform/Histogram.h" |
| 16 #include "public/platform/Platform.h" | 16 #include "public/platform/Platform.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 Element* ElementFromCenter(Element& element) { | 22 Element* ElementFromCenter(Element& element) { |
| 23 ClientRect* client_rect = element.getBoundingClientRect(); | 23 DOMRect* client_rect = element.getBoundingClientRect(); |
| 24 int center_x = | 24 int center_x = |
| 25 static_cast<int>((client_rect->left() + client_rect->right()) / 2); | 25 static_cast<int>((client_rect->left() + client_rect->right()) / 2); |
| 26 int center_y = | 26 int center_y = |
| 27 static_cast<int>((client_rect->top() + client_rect->bottom()) / 2); | 27 static_cast<int>((client_rect->top() + client_rect->bottom()) / 2); |
| 28 | 28 |
| 29 return element.GetDocument().ElementFromPoint(center_x, center_y); | 29 return element.GetDocument().ElementFromPoint(center_x, center_y); |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // anonymous namespace | 32 } // anonymous namespace |
| 33 | 33 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 overlay_histogram.Count(static_cast<int>(metric)); | 133 overlay_histogram.Count(static_cast<int>(metric)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool MediaControlCastButtonElement::IsPlayingRemotely() const { | 136 bool MediaControlCastButtonElement::IsPlayingRemotely() const { |
| 137 RemotePlayback* remote = | 137 RemotePlayback* remote = |
| 138 HTMLMediaElementRemotePlayback::remote(MediaElement()); | 138 HTMLMediaElementRemotePlayback::remote(MediaElement()); |
| 139 return remote && remote->GetState() != WebRemotePlaybackState::kDisconnected; | 139 return remote && remote->GetState() != WebRemotePlaybackState::kDisconnected; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |