Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 789403002: Rename fullscreen_exit_bubble_* to exclusive_access_bubble_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated based on CR comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/browser/ui/tabs/tab_menu_model.h" 56 #include "chrome/browser/ui/tabs/tab_menu_model.h"
57 #include "chrome/browser/ui/tabs/tab_strip_model.h" 57 #include "chrome/browser/ui/tabs/tab_strip_model.h"
58 #include "chrome/browser/ui/view_ids.h" 58 #include "chrome/browser/ui/view_ids.h"
59 #include "chrome/browser/ui/views/accelerator_table.h" 59 #include "chrome/browser/ui/views/accelerator_table.h"
60 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" 60 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h"
61 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 61 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
62 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" 62 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
63 #include "chrome/browser/ui/views/browser_dialogs.h" 63 #include "chrome/browser/ui/views/browser_dialogs.h"
64 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" 64 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
65 #include "chrome/browser/ui/views/download/download_shelf_view.h" 65 #include "chrome/browser/ui/views/download/download_shelf_view.h"
66 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
66 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h" 67 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h"
67 #include "chrome/browser/ui/views/frame/browser_view_layout.h" 68 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
68 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" 69 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
69 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" 70 #include "chrome/browser/ui/views/frame/contents_layout_manager.h"
70 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 71 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
71 #include "chrome/browser/ui/views/frame/top_container_view.h" 72 #include "chrome/browser/ui/views/frame/top_container_view.h"
72 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" 73 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
73 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h"
74 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" 74 #include "chrome/browser/ui/views/infobars/infobar_container_view.h"
75 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 75 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
76 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 76 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
77 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 77 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
79 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" 79 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h"
80 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 80 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
81 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" 81 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
82 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" 82 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h"
83 #include "chrome/browser/ui/views/status_bubble_views.h" 83 #include "chrome/browser/ui/views/status_bubble_views.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 bool IsToolbarVisible() const override { 284 bool IsToolbarVisible() const override {
285 return browser_view_->IsToolbarVisible(); 285 return browser_view_->IsToolbarVisible();
286 } 286 }
287 287
288 bool IsBookmarkBarVisible() const override { 288 bool IsBookmarkBarVisible() const override {
289 return browser_view_->IsBookmarkBarVisible(); 289 return browser_view_->IsBookmarkBarVisible();
290 } 290 }
291 291
292 FullscreenExitBubbleViews* GetFullscreenExitBubble() const override { 292 ExclusiveAccessBubbleViews* GetExclusiveAccessBubble() const override {
293 return browser_view_->fullscreen_exit_bubble(); 293 return browser_view_->exclusive_access_bubble();
294 } 294 }
295 295
296 private: 296 private:
297 BrowserView* browser_view_; 297 BrowserView* browser_view_;
298 298
299 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutDelegateImpl); 299 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutDelegateImpl);
300 }; 300 };
301 301
302 /////////////////////////////////////////////////////////////////////////////// 302 ///////////////////////////////////////////////////////////////////////////////
303 // BookmarkExtensionBackground, private: 303 // BookmarkExtensionBackground, private:
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 867
868 void BrowserView::Minimize() { 868 void BrowserView::Minimize() {
869 frame_->Minimize(); 869 frame_->Minimize();
870 } 870 }
871 871
872 void BrowserView::Restore() { 872 void BrowserView::Restore() {
873 frame_->Restore(); 873 frame_->Restore();
874 } 874 }
875 875
876 void BrowserView::EnterFullscreen(const GURL& url, 876 void BrowserView::EnterFullscreen(const GURL& url,
877 FullscreenExitBubbleType bubble_type, 877 ExclusiveAccessBubbleType bubble_type,
878 bool with_toolbar) { 878 bool with_toolbar) {
879 if (IsFullscreen()) 879 if (IsFullscreen())
880 return; // Nothing to do. 880 return; // Nothing to do.
881 881
882 ProcessFullscreen(true, NORMAL_FULLSCREEN, url, bubble_type); 882 ProcessFullscreen(true, NORMAL_FULLSCREEN, url, bubble_type);
883 } 883 }
884 884
885 void BrowserView::ExitFullscreen() { 885 void BrowserView::ExitFullscreen() {
886 if (!IsFullscreen()) 886 if (!IsFullscreen())
887 return; // Nothing to do. 887 return; // Nothing to do.
888 888
889 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE); 889 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(),
890 EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
890 } 891 }
891 892
892 void BrowserView::UpdateFullscreenExitBubbleContent( 893 void BrowserView::UpdateFullscreenExitBubbleContent(
893 const GURL& url, 894 const GURL& url,
894 FullscreenExitBubbleType bubble_type) { 895 ExclusiveAccessBubbleType bubble_type) {
895 // Immersive mode has no exit bubble because it has a visible strip at the 896 // Immersive mode has no exit bubble because it has a visible strip at the
896 // top that gives the user a hover target. 897 // top that gives the user a hover target.
897 // TODO(jamescook): Figure out what to do with mouse-lock. 898 // TODO(jamescook): Figure out what to do with mouse-lock.
898 if (bubble_type == FEB_TYPE_NONE || ShouldUseImmersiveFullscreenForUrl(url)) { 899 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE ||
899 fullscreen_bubble_.reset(); 900 ShouldUseImmersiveFullscreenForUrl(url)) {
900 } else if (fullscreen_bubble_.get()) { 901 exclusive_access_bubble_.reset();
901 fullscreen_bubble_->UpdateContent(url, bubble_type); 902 } else if (exclusive_access_bubble_.get()) {
903 exclusive_access_bubble_->UpdateContent(url, bubble_type);
902 } else { 904 } else {
903 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( 905 exclusive_access_bubble_.reset(
904 this, url, bubble_type)); 906 new ExclusiveAccessBubbleViews(this, url, bubble_type));
905 } 907 }
906 } 908 }
907 909
908 bool BrowserView::ShouldHideUIForFullscreen() const { 910 bool BrowserView::ShouldHideUIForFullscreen() const {
909 // Immersive mode needs UI for the slide-down top panel. 911 // Immersive mode needs UI for the slide-down top panel.
910 if (immersive_mode_controller_->IsEnabled()) 912 if (immersive_mode_controller_->IsEnabled())
911 return false; 913 return false;
912 914
913 return IsFullscreen(); 915 return IsFullscreen();
914 } 916 }
915 917
916 bool BrowserView::IsFullscreen() const { 918 bool BrowserView::IsFullscreen() const {
917 return frame_->IsFullscreen(); 919 return frame_->IsFullscreen();
918 } 920 }
919 921
920 bool BrowserView::IsFullscreenBubbleVisible() const { 922 bool BrowserView::IsFullscreenBubbleVisible() const {
921 return fullscreen_bubble_ != nullptr; 923 return exclusive_access_bubble_ != nullptr;
922 } 924 }
923 925
924 bool BrowserView::SupportsFullscreenWithToolbar() const { 926 bool BrowserView::SupportsFullscreenWithToolbar() const {
925 return false; 927 return false;
926 } 928 }
927 929
928 void BrowserView::UpdateFullscreenWithToolbar(bool with_toolbar) { 930 void BrowserView::UpdateFullscreenWithToolbar(bool with_toolbar) {
929 // This is currently a Mac only feature. 931 // This is currently a Mac only feature.
930 NOTIMPLEMENTED(); 932 NOTIMPLEMENTED();
931 } 933 }
932 934
933 bool BrowserView::IsFullscreenWithToolbar() const { 935 bool BrowserView::IsFullscreenWithToolbar() const {
934 return false; 936 return false;
935 } 937 }
936 938
937 #if defined(OS_WIN) 939 #if defined(OS_WIN)
938 void BrowserView::SetMetroSnapMode(bool enable) { 940 void BrowserView::SetMetroSnapMode(bool enable) {
939 LOCAL_HISTOGRAM_COUNTS("Metro.SnapModeToggle", enable); 941 LOCAL_HISTOGRAM_COUNTS("Metro.SnapModeToggle", enable);
940 ProcessFullscreen(enable, METRO_SNAP_FULLSCREEN, GURL(), FEB_TYPE_NONE); 942 ProcessFullscreen(enable, METRO_SNAP_FULLSCREEN, GURL(),
943 EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
941 } 944 }
942 945
943 bool BrowserView::IsInMetroSnapMode() const { 946 bool BrowserView::IsInMetroSnapMode() const {
944 return false; 947 return false;
945 } 948 }
946 #endif // defined(OS_WIN) 949 #endif // defined(OS_WIN)
947 950
948 void BrowserView::RestoreFocus() { 951 void BrowserView::RestoreFocus() {
949 WebContents* selected_web_contents = GetActiveWebContents(); 952 WebContents* selected_web_contents = GetActiveWebContents();
950 if (selected_web_contents) 953 if (selected_web_contents)
951 selected_web_contents->RestoreFocus(); 954 selected_web_contents->RestoreFocus();
952 } 955 }
953 956
954 void BrowserView::FullscreenStateChanged() { 957 void BrowserView::FullscreenStateChanged() {
955 CHECK(!IsFullscreen()); 958 CHECK(!IsFullscreen());
956 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE); 959 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(),
960 EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
957 } 961 }
958 962
959 void BrowserView::ToolbarSizeChanged(bool is_animating) { 963 void BrowserView::ToolbarSizeChanged(bool is_animating) {
960 // The call to SetMaxTopArrowHeight() below can result in reentrancy; 964 // The call to SetMaxTopArrowHeight() below can result in reentrancy;
961 // |call_state| tracks whether we're reentrant. We can't just early-return in 965 // |call_state| tracks whether we're reentrant. We can't just early-return in
962 // this case because we need to layout again so the infobar container's bounds 966 // this case because we need to layout again so the infobar container's bounds
963 // are set correctly. 967 // are set correctly.
964 static CallState call_state = NORMAL; 968 static CallState call_state = NORMAL;
965 969
966 // A reentrant call can (and should) use the fast resize path unless both it 970 // A reentrant call can (and should) use the fast resize path unless both it
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 // TODO(jamescook): This function always returns true. Remove it and figure 2192 // TODO(jamescook): This function always returns true. Remove it and figure
2189 // out when layout is actually required. 2193 // out when layout is actually required.
2190 needs_layout |= MaybeShowInfoBar(contents); 2194 needs_layout |= MaybeShowInfoBar(contents);
2191 if (needs_layout) 2195 if (needs_layout)
2192 Layout(); 2196 Layout();
2193 } 2197 }
2194 2198
2195 void BrowserView::ProcessFullscreen(bool fullscreen, 2199 void BrowserView::ProcessFullscreen(bool fullscreen,
2196 FullscreenMode mode, 2200 FullscreenMode mode,
2197 const GURL& url, 2201 const GURL& url,
2198 FullscreenExitBubbleType bubble_type) { 2202 ExclusiveAccessBubbleType bubble_type) {
2199 if (in_process_fullscreen_) 2203 if (in_process_fullscreen_)
2200 return; 2204 return;
2201 in_process_fullscreen_ = true; 2205 in_process_fullscreen_ = true;
2202 2206
2203 // Reduce jankiness during the following position changes by: 2207 // Reduce jankiness during the following position changes by:
2204 // * Hiding the window until it's in the final position 2208 // * Hiding the window until it's in the final position
2205 // * Ignoring all intervening Layout() calls, which resize the webpage and 2209 // * Ignoring all intervening Layout() calls, which resize the webpage and
2206 // thus are slow and look ugly (enforced via |in_process_fullscreen_|). 2210 // thus are slow and look ugly (enforced via |in_process_fullscreen_|).
2207 LocationBarView* location_bar = GetLocationBarView(); 2211 LocationBarView* location_bar = GetLocationBarView();
2208 2212
2209 if (mode == METRO_SNAP_FULLSCREEN || !fullscreen) { 2213 if (mode == METRO_SNAP_FULLSCREEN || !fullscreen) {
2210 // Hide the fullscreen bubble as soon as possible, since the mode toggle can 2214 // Hide the fullscreen bubble as soon as possible, since the mode toggle can
2211 // take enough time for the user to notice. 2215 // take enough time for the user to notice.
2212 fullscreen_bubble_.reset(); 2216 exclusive_access_bubble_.reset();
2213 } 2217 }
2214 2218
2215 if (fullscreen) { 2219 if (fullscreen) {
2216 // Move focus out of the location bar if necessary. 2220 // Move focus out of the location bar if necessary.
2217 views::FocusManager* focus_manager = GetFocusManager(); 2221 views::FocusManager* focus_manager = GetFocusManager();
2218 DCHECK(focus_manager); 2222 DCHECK(focus_manager);
2219 // Look for focus in the location bar itself or any child view. 2223 // Look for focus in the location bar itself or any child view.
2220 if (location_bar->Contains(focus_manager->GetFocusedView())) 2224 if (location_bar->Contains(focus_manager->GetFocusedView()))
2221 focus_manager->ClearFocus(); 2225 focus_manager->ClearFocus();
2222 } 2226 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2528 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2525 gfx::Point icon_bottom( 2529 gfx::Point icon_bottom(
2526 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2530 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2527 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2531 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2528 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2532 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2529 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2533 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2530 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2534 top_arrow_height = infobar_top.y() - icon_bottom.y();
2531 } 2535 }
2532 return top_arrow_height; 2536 return top_arrow_height;
2533 } 2537 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/frame/browser_view_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698