1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "third_party/blink/renderer/modules/media_controls/elements/media_control_remaining_time_display_element.h"
7 #include "third_party/blink/public/strings/grit/blink_strings.h"
8 #include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
9 #if BUILDFLAG(IS_TIZEN_TV)
10 #include "third_party/blink/renderer/core/html/media/html_media_element.h"
15 // The during element has extra '/ ' in the text which takes approximately
17 constexpr int kTimeDisplayExtraCharacterWidth = 9;
23 MediaControlRemainingTimeDisplayElement::
24 MediaControlRemainingTimeDisplayElement(MediaControlsImpl& media_controls)
25 : MediaControlTimeDisplayElement(media_controls) {
27 AtomicString("-webkit-media-controls-time-remaining-display"));
30 int MediaControlRemainingTimeDisplayElement::EstimateElementWidth() const {
31 // Add extra pixel width for during display since we have an extra "/ ".
32 return kTimeDisplayExtraCharacterWidth +
33 MediaControlTimeDisplayElement::EstimateElementWidth();
36 String MediaControlRemainingTimeDisplayElement::FormatTime() const {
37 #if BUILDFLAG(IS_TIZEN_TV)
38 if (MediaElement().IsFullscreen()) {
39 return MediaControlTimeDisplayElement::FormatTime();
42 // For the duration display, we prepend a "/ " to deliminate the current
43 // time from the duration, e.g. "0:12 / 3:45".
44 return "/ " + MediaControlTimeDisplayElement::FormatTime();