OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
971 | 971 |
972 void BrowserView::UpdateExclusiveAccessExitBubbleContent( | 972 void BrowserView::UpdateExclusiveAccessExitBubbleContent( |
973 const GURL& url, | 973 const GURL& url, |
974 ExclusiveAccessBubbleType bubble_type) { | 974 ExclusiveAccessBubbleType bubble_type) { |
975 // Immersive mode has no exit bubble because it has a visible strip at the | 975 // Immersive mode has no exit bubble because it has a visible strip at the |
976 // top that gives the user a hover target. | 976 // top that gives the user a hover target. |
977 // TODO(jamescook): Figure out what to do with mouse-lock. | 977 // TODO(jamescook): Figure out what to do with mouse-lock. |
978 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || | 978 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || |
979 ShouldUseImmersiveFullscreenForUrl(url)) { | 979 ShouldUseImmersiveFullscreenForUrl(url)) { |
980 exclusive_access_bubble_.reset(); | 980 exclusive_access_bubble_.reset(); |
981 } else if (exclusive_access_bubble_.get()) { | 981 return; |
982 } | |
983 | |
984 // Hide the backspace shortcut bubble, to avoid overlapping. | |
985 new_back_shortcut_bubble_.reset(); | |
986 | |
987 if (exclusive_access_bubble_) { | |
982 exclusive_access_bubble_->UpdateContent(url, bubble_type); | 988 exclusive_access_bubble_->UpdateContent(url, bubble_type); |
983 } else { | 989 return; |
984 exclusive_access_bubble_.reset( | |
985 new ExclusiveAccessBubbleViews(this, url, bubble_type)); | |
986 } | 990 } |
991 | |
992 exclusive_access_bubble_.reset( | |
993 new ExclusiveAccessBubbleViews(this, url, bubble_type)); | |
987 } | 994 } |
988 | 995 |
989 void BrowserView::OnExclusiveAccessUserInput() { | 996 void BrowserView::OnExclusiveAccessUserInput() { |
990 if (exclusive_access_bubble_.get()) | 997 if (exclusive_access_bubble_.get()) |
991 exclusive_access_bubble_->OnUserInput(); | 998 exclusive_access_bubble_->OnUserInput(); |
992 } | 999 } |
993 | 1000 |
994 bool BrowserView::ShouldHideUIForFullscreen() const { | 1001 bool BrowserView::ShouldHideUIForFullscreen() const { |
995 // Immersive mode needs UI for the slide-down top panel. | 1002 // Immersive mode needs UI for the slide-down top panel. |
996 if (immersive_mode_controller_->IsEnabled()) | 1003 if (immersive_mode_controller_->IsEnabled()) |
997 return false; | 1004 return false; |
998 | 1005 |
999 return IsFullscreen(); | 1006 return IsFullscreen(); |
1000 } | 1007 } |
1001 | 1008 |
1002 bool BrowserView::IsFullscreen() const { | 1009 bool BrowserView::IsFullscreen() const { |
1003 return frame_->IsFullscreen(); | 1010 return frame_->IsFullscreen(); |
1004 } | 1011 } |
1005 | 1012 |
1006 bool BrowserView::IsFullscreenBubbleVisible() const { | 1013 bool BrowserView::IsFullscreenBubbleVisible() const { |
1007 return exclusive_access_bubble_ != nullptr; | 1014 return exclusive_access_bubble_ != nullptr; |
1008 } | 1015 } |
1009 | 1016 |
1017 void BrowserView::ShowNewBackShortcutBubble(bool forward) { | |
1018 // Hide the exclusive access bubble, to avoid overlapping. | |
1019 exclusive_access_bubble_.reset(); | |
1020 | |
1021 if (new_back_shortcut_bubble_) { | |
1022 new_back_shortcut_bubble_->UpdateContent(forward); | |
1023 return; | |
1024 } | |
1025 | |
1026 new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward)); | |
Peter Kasting
2016/05/24 23:35:08
Nit: Shorter:
if (new_back_shortcut_bubble_)
Matt Giuca
2016/05/26 04:37:34
Well there's a general (unwritten) rule in Chromiu
Peter Kasting
2016/05/26 05:19:40
Huh, really? I ask for early returns in cases whe
Matt Giuca
2016/05/26 06:05:39
Oh OK. Well I think some people take the "no else
| |
1027 } | |
1028 | |
1010 void BrowserView::RestoreFocus() { | 1029 void BrowserView::RestoreFocus() { |
1011 WebContents* selected_web_contents = GetActiveWebContents(); | 1030 WebContents* selected_web_contents = GetActiveWebContents(); |
1012 if (selected_web_contents) | 1031 if (selected_web_contents) |
1013 selected_web_contents->RestoreFocus(); | 1032 selected_web_contents->RestoreFocus(); |
1014 } | 1033 } |
1015 | 1034 |
1016 void BrowserView::FullscreenStateChanged() { | 1035 void BrowserView::FullscreenStateChanged() { |
1017 CHECK(!IsFullscreen()); | 1036 CHECK(!IsFullscreen()); |
1018 ProcessFullscreen(false, GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); | 1037 ProcessFullscreen(false, GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); |
1019 } | 1038 } |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2625 } | 2644 } |
2626 | 2645 |
2627 extensions::ActiveTabPermissionGranter* | 2646 extensions::ActiveTabPermissionGranter* |
2628 BrowserView::GetActiveTabPermissionGranter() { | 2647 BrowserView::GetActiveTabPermissionGranter() { |
2629 content::WebContents* web_contents = GetActiveWebContents(); | 2648 content::WebContents* web_contents = GetActiveWebContents(); |
2630 if (!web_contents) | 2649 if (!web_contents) |
2631 return nullptr; | 2650 return nullptr; |
2632 return extensions::TabHelper::FromWebContents(web_contents) | 2651 return extensions::TabHelper::FromWebContents(web_contents) |
2633 ->active_tab_permission_granter(); | 2652 ->active_tab_permission_granter(); |
2634 } | 2653 } |
OLD | NEW |