OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 } | 574 } |
575 | 575 |
576 void MediaControlsImpl::MaybeShow() { | 576 void MediaControlsImpl::MaybeShow() { |
577 panel_->SetIsWanted(true); | 577 panel_->SetIsWanted(true); |
578 panel_->SetIsDisplayed(true); | 578 panel_->SetIsDisplayed(true); |
579 if (overlay_play_button_) | 579 if (overlay_play_button_) |
580 overlay_play_button_->UpdateDisplayType(); | 580 overlay_play_button_->UpdateDisplayType(); |
581 // Only make the controls visible if they won't get hidden by OnTimeUpdate. | 581 // Only make the controls visible if they won't get hidden by OnTimeUpdate. |
582 if (MediaElement().paused() || !ShouldHideMediaControls()) | 582 if (MediaElement().paused() || !ShouldHideMediaControls()) |
583 MakeOpaque(); | 583 MakeOpaque(); |
584 download_button_->UpdateInProductHelpState(); | |
mlamouri (slow - plz ping)
2017/07/13 21:14:27
`MakeOpaque()` is what you care about here. I'm af
Khushal
2017/07/17 17:52:20
So I think I wasn't understanding the 2 states on
| |
584 } | 585 } |
585 | 586 |
586 void MediaControlsImpl::Hide() { | 587 void MediaControlsImpl::Hide() { |
587 panel_->SetIsWanted(false); | 588 panel_->SetIsWanted(false); |
588 panel_->SetIsDisplayed(false); | 589 panel_->SetIsDisplayed(false); |
589 if (overlay_play_button_) | 590 if (overlay_play_button_) |
590 overlay_play_button_->SetIsWanted(false); | 591 overlay_play_button_->SetIsWanted(false); |
592 download_button_->UpdateInProductHelpState(); | |
591 } | 593 } |
592 | 594 |
593 bool MediaControlsImpl::IsVisible() const { | 595 bool MediaControlsImpl::IsVisible() const { |
594 return panel_->IsOpaque(); | 596 return panel_->IsOpaque(); |
595 } | 597 } |
596 | 598 |
597 void MediaControlsImpl::MakeOpaque() { | 599 void MediaControlsImpl::MakeOpaque() { |
598 panel_->MakeOpaque(); | 600 panel_->MakeOpaque(); |
599 } | 601 } |
600 | 602 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 const bool ignore_focus = behavior_flags & kIgnoreFocus; | 638 const bool ignore_focus = behavior_flags & kIgnoreFocus; |
637 if (!ignore_focus && (MediaElement().IsFocused() || | 639 if (!ignore_focus && (MediaElement().IsFocused() || |
638 contains(GetDocument().FocusedElement()))) { | 640 contains(GetDocument().FocusedElement()))) { |
639 return false; | 641 return false; |
640 } | 642 } |
641 | 643 |
642 // Don't hide the media controls when a panel is showing. | 644 // Don't hide the media controls when a panel is showing. |
643 if (text_track_list_->IsWanted() || overflow_list_->IsWanted()) | 645 if (text_track_list_->IsWanted() || overflow_list_->IsWanted()) |
644 return false; | 646 return false; |
645 | 647 |
648 // Don't hide the media controls while the in product help is showing. | |
649 if (download_button_->IsShowingInProductHelp()) | |
650 return false; | |
651 | |
646 return true; | 652 return true; |
647 } | 653 } |
648 | 654 |
649 void MediaControlsImpl::UpdatePlayState() { | 655 void MediaControlsImpl::UpdatePlayState() { |
650 if (is_paused_for_scrubbing_) | 656 if (is_paused_for_scrubbing_) |
651 return; | 657 return; |
652 | 658 |
653 if (overlay_play_button_) | 659 if (overlay_play_button_) |
654 overlay_play_button_->UpdateDisplayType(); | 660 overlay_play_button_->UpdateDisplayType(); |
655 play_button_->UpdateDisplayType(); | 661 play_button_->UpdateDisplayType(); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
964 UpdateCurrentTimeDisplay(); | 970 UpdateCurrentTimeDisplay(); |
965 | 971 |
966 // Update the timeline (the UI with the seek marker). | 972 // Update the timeline (the UI with the seek marker). |
967 timeline_->SetDuration(duration); | 973 timeline_->SetDuration(duration); |
968 } | 974 } |
969 | 975 |
970 void MediaControlsImpl::OnPlay() { | 976 void MediaControlsImpl::OnPlay() { |
971 UpdatePlayState(); | 977 UpdatePlayState(); |
972 timeline_->SetPosition(MediaElement().currentTime()); | 978 timeline_->SetPosition(MediaElement().currentTime()); |
973 UpdateCurrentTimeDisplay(); | 979 UpdateCurrentTimeDisplay(); |
980 download_button_->MaybeDispatchInProductHelpTrigger(); | |
974 } | 981 } |
975 | 982 |
976 void MediaControlsImpl::OnPlaying() { | 983 void MediaControlsImpl::OnPlaying() { |
977 timeline_->OnPlaying(); | 984 timeline_->OnPlaying(); |
978 | 985 |
979 StartHideMediaControlsTimer(); | 986 StartHideMediaControlsTimer(); |
980 } | 987 } |
981 | 988 |
982 void MediaControlsImpl::OnPause() { | 989 void MediaControlsImpl::OnPause() { |
983 UpdatePlayState(); | 990 UpdatePlayState(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1209 | 1216 |
1210 void MediaControlsImpl::HideAllMenus() { | 1217 void MediaControlsImpl::HideAllMenus() { |
1211 window_event_listener_->Stop(); | 1218 window_event_listener_->Stop(); |
1212 | 1219 |
1213 if (overflow_list_->IsWanted()) | 1220 if (overflow_list_->IsWanted()) |
1214 overflow_list_->SetIsWanted(false); | 1221 overflow_list_->SetIsWanted(false); |
1215 if (text_track_list_->IsWanted()) | 1222 if (text_track_list_->IsWanted()) |
1216 text_track_list_->SetVisible(false); | 1223 text_track_list_->SetVisible(false); |
1217 } | 1224 } |
1218 | 1225 |
1226 void MediaControlsImpl::HideControlsIfNecessary() { | |
1227 if (ShouldHideMediaControls()) | |
1228 StartHideMediaControlsTimer(); | |
mlamouri (slow - plz ping)
2017/07/13 21:14:27
There is at least one other place with this logic.
Khushal
2017/07/17 17:52:20
Done.
| |
1229 } | |
1230 | |
1219 DEFINE_TRACE(MediaControlsImpl) { | 1231 DEFINE_TRACE(MediaControlsImpl) { |
1220 visitor->Trace(element_mutation_callback_); | 1232 visitor->Trace(element_mutation_callback_); |
1221 visitor->Trace(resize_observer_); | 1233 visitor->Trace(resize_observer_); |
1222 visitor->Trace(panel_); | 1234 visitor->Trace(panel_); |
1223 visitor->Trace(overlay_play_button_); | 1235 visitor->Trace(overlay_play_button_); |
1224 visitor->Trace(overlay_enclosure_); | 1236 visitor->Trace(overlay_enclosure_); |
1225 visitor->Trace(play_button_); | 1237 visitor->Trace(play_button_); |
1226 visitor->Trace(current_time_display_); | 1238 visitor->Trace(current_time_display_); |
1227 visitor->Trace(timeline_); | 1239 visitor->Trace(timeline_); |
1228 visitor->Trace(mute_button_); | 1240 visitor->Trace(mute_button_); |
(...skipping 10 matching lines...) Expand all Loading... | |
1239 visitor->Trace(overlay_cast_button_); | 1251 visitor->Trace(overlay_cast_button_); |
1240 visitor->Trace(media_event_listener_); | 1252 visitor->Trace(media_event_listener_); |
1241 visitor->Trace(window_event_listener_); | 1253 visitor->Trace(window_event_listener_); |
1242 visitor->Trace(orientation_lock_delegate_); | 1254 visitor->Trace(orientation_lock_delegate_); |
1243 visitor->Trace(rotate_to_fullscreen_delegate_); | 1255 visitor->Trace(rotate_to_fullscreen_delegate_); |
1244 MediaControls::Trace(visitor); | 1256 MediaControls::Trace(visitor); |
1245 HTMLDivElement::Trace(visitor); | 1257 HTMLDivElement::Trace(visitor); |
1246 } | 1258 } |
1247 | 1259 |
1248 } // namespace blink | 1260 } // namespace blink |
OLD | NEW |