| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 75 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 76 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 76 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 77 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 77 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 78 #include "chrome/browser/ui/views/frame/top_container_view.h" | 78 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 79 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 79 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
| 80 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" | 80 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" |
| 81 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 81 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 82 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 82 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 83 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 83 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 84 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 84 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 85 #include "chrome/browser/ui/views/new_back_shortcut_bubble.h" |
| 85 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 86 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 86 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 87 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 87 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 88 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 88 #include "chrome/browser/ui/views/session_crashed_bubble_view.h" | 89 #include "chrome/browser/ui/views/session_crashed_bubble_view.h" |
| 89 #include "chrome/browser/ui/views/status_bubble_views.h" | 90 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 90 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 91 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 91 #include "chrome/browser/ui/views/tabs/tab.h" | 92 #include "chrome/browser/ui/views/tabs/tab.h" |
| 92 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 93 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 93 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 94 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 94 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 95 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 | 972 |
| 972 void BrowserView::UpdateExclusiveAccessExitBubbleContent( | 973 void BrowserView::UpdateExclusiveAccessExitBubbleContent( |
| 973 const GURL& url, | 974 const GURL& url, |
| 974 ExclusiveAccessBubbleType bubble_type) { | 975 ExclusiveAccessBubbleType bubble_type) { |
| 975 // Immersive mode has no exit bubble because it has a visible strip at the | 976 // Immersive mode has no exit bubble because it has a visible strip at the |
| 976 // top that gives the user a hover target. | 977 // top that gives the user a hover target. |
| 977 // TODO(jamescook): Figure out what to do with mouse-lock. | 978 // TODO(jamescook): Figure out what to do with mouse-lock. |
| 978 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || | 979 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || |
| 979 ShouldUseImmersiveFullscreenForUrl(url)) { | 980 ShouldUseImmersiveFullscreenForUrl(url)) { |
| 980 exclusive_access_bubble_.reset(); | 981 exclusive_access_bubble_.reset(); |
| 981 } else if (exclusive_access_bubble_.get()) { | 982 return; |
| 983 } |
| 984 |
| 985 // Hide the backspace shortcut bubble, to avoid overlapping. |
| 986 new_back_shortcut_bubble_.reset(); |
| 987 |
| 988 if (exclusive_access_bubble_) { |
| 982 exclusive_access_bubble_->UpdateContent(url, bubble_type); | 989 exclusive_access_bubble_->UpdateContent(url, bubble_type); |
| 983 } else { | 990 } else { |
| 984 exclusive_access_bubble_.reset( | 991 exclusive_access_bubble_.reset( |
| 985 new ExclusiveAccessBubbleViews(this, url, bubble_type)); | 992 new ExclusiveAccessBubbleViews(this, url, bubble_type)); |
| 986 } | 993 } |
| 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 else |
| 1024 new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward)); |
| 1025 } |
| 1026 |
| 1010 void BrowserView::RestoreFocus() { | 1027 void BrowserView::RestoreFocus() { |
| 1011 WebContents* selected_web_contents = GetActiveWebContents(); | 1028 WebContents* selected_web_contents = GetActiveWebContents(); |
| 1012 if (selected_web_contents) | 1029 if (selected_web_contents) |
| 1013 selected_web_contents->RestoreFocus(); | 1030 selected_web_contents->RestoreFocus(); |
| 1014 } | 1031 } |
| 1015 | 1032 |
| 1016 void BrowserView::FullscreenStateChanged() { | 1033 void BrowserView::FullscreenStateChanged() { |
| 1017 CHECK(!IsFullscreen()); | 1034 CHECK(!IsFullscreen()); |
| 1018 ProcessFullscreen(false, GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); | 1035 ProcessFullscreen(false, GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); |
| 1019 } | 1036 } |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 } | 2642 } |
| 2626 | 2643 |
| 2627 extensions::ActiveTabPermissionGranter* | 2644 extensions::ActiveTabPermissionGranter* |
| 2628 BrowserView::GetActiveTabPermissionGranter() { | 2645 BrowserView::GetActiveTabPermissionGranter() { |
| 2629 content::WebContents* web_contents = GetActiveWebContents(); | 2646 content::WebContents* web_contents = GetActiveWebContents(); |
| 2630 if (!web_contents) | 2647 if (!web_contents) |
| 2631 return nullptr; | 2648 return nullptr; |
| 2632 return extensions::TabHelper::FromWebContents(web_contents) | 2649 return extensions::TabHelper::FromWebContents(web_contents) |
| 2633 ->active_tab_permission_granter(); | 2650 ->active_tab_permission_granter(); |
| 2634 } | 2651 } |
| OLD | NEW |