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

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

Issue 962453002: Update permission bubble anchor when omnibar is hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move anchor logic to PermissionBubbleViewViews Created 5 years, 9 months 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // static 532 // static
533 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { 533 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) {
534 return static_cast<BrowserView*>(browser->window()); 534 return static_cast<BrowserView*>(browser->window());
535 } 535 }
536 536
537 void BrowserView::InitStatusBubble() { 537 void BrowserView::InitStatusBubble() {
538 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); 538 status_bubble_.reset(new StatusBubbleViews(contents_web_view_));
539 contents_web_view_->SetStatusBubble(status_bubble_.get()); 539 contents_web_view_->SetStatusBubble(status_bubble_.get());
540 } 540 }
541 541
542 void BrowserView::InitPermissionBubbleView() {
543 std::string languages =
544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
545 permission_bubble_view_.reset(new PermissionBubbleViewViews(
546 GetLocationBarView()->location_icon_view(), languages));
547 }
548
549 gfx::Rect BrowserView::GetToolbarBounds() const { 542 gfx::Rect BrowserView::GetToolbarBounds() const {
550 gfx::Rect toolbar_bounds(toolbar_->bounds()); 543 gfx::Rect toolbar_bounds(toolbar_->bounds());
551 if (toolbar_bounds.IsEmpty()) 544 if (toolbar_bounds.IsEmpty())
552 return toolbar_bounds; 545 return toolbar_bounds;
553 // The apparent toolbar edges are outside the "real" toolbar edges. 546 // The apparent toolbar edges are outside the "real" toolbar edges.
554 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); 547 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
555 return toolbar_bounds; 548 return toolbar_bounds;
556 } 549 }
557 550
558 gfx::Rect BrowserView::GetFindBarBoundingBox() const { 551 gfx::Rect BrowserView::GetFindBarBoundingBox() const {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 840 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
848 } 841 }
849 842
850 infobar_container_->ChangeInfoBarManager( 843 infobar_container_->ChangeInfoBarManager(
851 InfoBarService::FromWebContents(new_contents)); 844 InfoBarService::FromWebContents(new_contents));
852 845
853 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) 846 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents))
854 PermissionBubbleManager::FromWebContents(old_contents)->SetView(nullptr); 847 PermissionBubbleManager::FromWebContents(old_contents)->SetView(nullptr);
855 848
856 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { 849 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) {
850 if (!permission_bubble_view_.get()) {
851 permission_bubble_view_.reset(new PermissionBubbleViewViews(
852 browser_.get(), this));
853 }
854
857 PermissionBubbleManager::FromWebContents(new_contents)->SetView( 855 PermissionBubbleManager::FromWebContents(new_contents)->SetView(
858 permission_bubble_view_.get()); 856 permission_bubble_view_.get());
859 } 857 }
860 858
861 UpdateUIForContents(new_contents); 859 UpdateUIForContents(new_contents);
862 860
863 // Layout for DevTools _before_ setting the both main and devtools WebContents 861 // Layout for DevTools _before_ setting the both main and devtools WebContents
864 // to avoid toggling the size of any of them. 862 // to avoid toggling the size of any of them.
865 UpdateDevToolsForContents(new_contents, !change_tab_contents); 863 UpdateDevToolsForContents(new_contents, !change_tab_contents);
866 864
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 browser_->tab_strip_model()); 2031 browser_->tab_strip_model());
2034 tabstrip_ = new TabStrip(tabstrip_controller); 2032 tabstrip_ = new TabStrip(tabstrip_controller);
2035 top_container_->AddChildView(tabstrip_); 2033 top_container_->AddChildView(tabstrip_);
2036 tabstrip_controller->InitFromModel(tabstrip_); 2034 tabstrip_controller->InitFromModel(tabstrip_);
2037 2035
2038 toolbar_ = new ToolbarView(browser_.get()); 2036 toolbar_ = new ToolbarView(browser_.get());
2039 top_container_->AddChildView(toolbar_); 2037 top_container_->AddChildView(toolbar_);
2040 toolbar_->Init(); 2038 toolbar_->Init();
2041 2039
2042 InitStatusBubble(); 2040 InitStatusBubble();
2043 InitPermissionBubbleView();
2044 2041
2045 // Create do-nothing view for the sake of controlling the z-order of the find 2042 // Create do-nothing view for the sake of controlling the z-order of the find
2046 // bar widget. 2043 // bar widget.
2047 find_bar_host_view_ = new View(); 2044 find_bar_host_view_ = new View();
2048 AddChildView(find_bar_host_view_); 2045 AddChildView(find_bar_host_view_);
2049 2046
2050 immersive_mode_controller_->Init(this); 2047 immersive_mode_controller_->Init(this);
2051 2048
2052 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; 2049 BrowserViewLayout* browser_view_layout = new BrowserViewLayout;
2053 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), 2050 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this),
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 } 2281 }
2285 2282
2286 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2283 // Undo our anti-jankiness hacks and force a re-layout. We also need to
2287 // recompute the height of the infobar top arrow because toggling in and out 2284 // recompute the height of the infobar top arrow because toggling in and out
2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2285 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2289 // things since it computes the arrow height directly and forces a layout 2286 // things since it computes the arrow height directly and forces a layout
2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in 2287 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in
2291 // order to let the layout occur. 2288 // order to let the layout occur.
2292 in_process_fullscreen_ = false; 2289 in_process_fullscreen_ = false;
2293 ToolbarSizeChanged(false); 2290 ToolbarSizeChanged(false);
2291
2292 if (permission_bubble_view_.get())
2293 permission_bubble_view_->UpdateAnchorPosition();
msw 2015/03/17 21:13:15 As a views::BubbleDelegateView, PermissionsBubbleD
hcarmona 2015/03/18 18:00:05 Done, with some differences: rather than updating
2294 } 2294 }
2295 2295
2296 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { 2296 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2297 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop 2297 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop
2298 // immersive fullscreen doesn't exist. 2298 // immersive fullscreen doesn't exist.
2299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || 2299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) ||
2300 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { 2300 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) {
2301 return false; 2301 return false;
2302 } 2302 }
2303 2303
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 return immersive_mode_controller()->IsEnabled(); 2604 return immersive_mode_controller()->IsEnabled();
2605 } 2605 }
2606 2606
2607 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2607 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2608 return GetWidget(); 2608 return GetWidget();
2609 } 2609 }
2610 2610
2611 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2611 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2612 return top_container_->GetBoundsInScreen(); 2612 return top_container_->GetBoundsInScreen();
2613 } 2613 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698