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

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

Issue 739793003: Close bubbles not on UpdateToolbar but when the activated tab is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move updating the zoom bubble; Move impelementation to OnActiveTabChanged Created 6 years, 1 month 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "chrome/browser/ui/views/frame/browser_view_layout.h" 67 #include "chrome/browser/ui/views/frame/browser_view_layout.h"
68 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" 68 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
69 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" 69 #include "chrome/browser/ui/views/frame/contents_layout_manager.h"
70 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 70 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
71 #include "chrome/browser/ui/views/frame/top_container_view.h" 71 #include "chrome/browser/ui/views/frame/top_container_view.h"
72 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" 72 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
73 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.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/omnibox/omnibox_view_views.h" 78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
78 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" 79 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h"
79 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 80 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
80 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" 81 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
81 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" 82 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h"
82 #include "chrome/browser/ui/views/status_bubble_views.h" 83 #include "chrome/browser/ui/views/status_bubble_views.h"
83 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 84 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
84 #include "chrome/browser/ui/views/tabs/tab.h" 85 #include "chrome/browser/ui/views/tabs/tab.h"
85 #include "chrome/browser/ui/views/tabs/tab_strip.h" 86 #include "chrome/browser/ui/views/tabs/tab_strip.h"
86 #include "chrome/browser/ui/views/toolbar/reload_button.h" 87 #include "chrome/browser/ui/views/toolbar/reload_button.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 PermissionBubbleManager::FromWebContents(new_contents)->SetView( 801 PermissionBubbleManager::FromWebContents(new_contents)->SetView(
801 permission_bubble_view_.get()); 802 permission_bubble_view_.get());
802 } 803 }
803 804
804 UpdateUIForContents(new_contents); 805 UpdateUIForContents(new_contents);
805 806
806 // Layout for DevTools _before_ setting the both main and devtools WebContents 807 // Layout for DevTools _before_ setting the both main and devtools WebContents
807 // to avoid toggling the size of any of them. 808 // to avoid toggling the size of any of them.
808 UpdateDevToolsForContents(new_contents, !change_tab_contents); 809 UpdateDevToolsForContents(new_contents, !change_tab_contents);
809 810
810 if (change_tab_contents) { 811 if (change_tab_contents) {
Peter Kasting 2014/11/19 19:23:20 Do we need to guard the calls below under this con
hajimehoshi 2014/11/20 05:12:30 You added this variable?: https://codereview.chrom
Peter Kasting 2014/11/20 06:27:44 That in no way means I recall why I did! :) Seri
811 web_contents_close_handler_->ActiveTabChanged(); 812 web_contents_close_handler_->ActiveTabChanged();
812 contents_web_view_->SetWebContents(new_contents); 813 contents_web_view_->SetWebContents(new_contents);
813 // The second layout update should be no-op. It will just set the 814 // The second layout update should be no-op. It will just set the
814 // DevTools WebContents. 815 // DevTools WebContents.
815 UpdateDevToolsForContents(new_contents, true); 816 UpdateDevToolsForContents(new_contents, true);
816 } 817 }
817 818
818 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && 819 if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() &&
819 GetWidget()->IsVisible()) { 820 GetWidget()->IsVisible()) {
820 // We only restore focus if our window is visible, to avoid invoking blur 821 // We only restore focus if our window is visible, to avoid invoking blur
821 // handlers when we are eventually shown. 822 // handlers when we are eventually shown.
822 new_contents->RestoreFocus(); 823 new_contents->RestoreFocus();
823 } 824 }
824 825
825 // Update all the UI bits. 826 // Update all the UI bits.
826 UpdateTitleBar(); 827 UpdateTitleBar();
828
829 TranslateBubbleView::CloseBubble();
830 ZoomBubbleView::CloseBubble();
827 } 831 }
828 832
829 void BrowserView::ZoomChangedForActiveTab(bool can_show_bubble) { 833 void BrowserView::ZoomChangedForActiveTab(bool can_show_bubble) {
830 GetLocationBarView()->ZoomChangedForActiveTab( 834 GetLocationBarView()->ZoomChangedForActiveTab(
831 can_show_bubble && !toolbar_->IsWrenchMenuShowing()); 835 can_show_bubble && !toolbar_->IsWrenchMenuShowing());
832 } 836 }
833 837
834 gfx::Rect BrowserView::GetRestoredBounds() const { 838 gfx::Rect BrowserView::GetRestoredBounds() const {
835 gfx::Rect bounds; 839 gfx::Rect bounds;
836 ui::WindowShowState state; 840 ui::WindowShowState state;
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2502 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2499 gfx::Point icon_bottom( 2503 gfx::Point icon_bottom(
2500 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2504 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2501 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2505 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2502 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2506 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2503 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2507 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2504 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2508 top_arrow_height = infobar_top.y() - icon_bottom.y();
2505 } 2509 }
2506 return top_arrow_height; 2510 return top_arrow_height;
2507 } 2511 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698