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

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: Apply Feedback 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 542 void BrowserView::InitPermissionBubbleView() {
543 std::string languages =
544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages);
545 permission_bubble_view_.reset(new PermissionBubbleViewViews( 543 permission_bubble_view_.reset(new PermissionBubbleViewViews(
546 GetLocationBarView()->location_icon_view(), languages)); 544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)));
545 UpdatePermissionBubbleViewAnchor();
546 }
547
548 void BrowserView::UpdatePermissionBubbleViewAnchor() {
msw 2015/03/12 20:44:05 For a one-off like this without imminent plans to
hcarmona 2015/03/17 01:29:27 Done.
549 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) {
550 permission_bubble_view_->SetAnchor(
551 GetLocationBarView()->location_icon_view(),
552 views::BubbleBorder::TOP_LEFT);
553 } else {
554 views::View* view = top_container_;
555
556 if (IsFullscreenBubbleVisible())
557 view = exclusive_access_bubble_->GetView();
558
559 permission_bubble_view_->SetAnchor(view, views::BubbleBorder::NONE);
560 }
547 } 561 }
548 562
549 gfx::Rect BrowserView::GetToolbarBounds() const { 563 gfx::Rect BrowserView::GetToolbarBounds() const {
550 gfx::Rect toolbar_bounds(toolbar_->bounds()); 564 gfx::Rect toolbar_bounds(toolbar_->bounds());
551 if (toolbar_bounds.IsEmpty()) 565 if (toolbar_bounds.IsEmpty())
552 return toolbar_bounds; 566 return toolbar_bounds;
553 // The apparent toolbar edges are outside the "real" toolbar edges. 567 // The apparent toolbar edges are outside the "real" toolbar edges.
554 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); 568 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
555 return toolbar_bounds; 569 return toolbar_bounds;
556 } 570 }
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 } 2298 }
2285 2299
2286 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2300 // 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 2301 // recompute the height of the infobar top arrow because toggling in and out
2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2302 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2289 // things since it computes the arrow height directly and forces a layout 2303 // things since it computes the arrow height directly and forces a layout
2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in 2304 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in
2291 // order to let the layout occur. 2305 // order to let the layout occur.
2292 in_process_fullscreen_ = false; 2306 in_process_fullscreen_ = false;
2293 ToolbarSizeChanged(false); 2307 ToolbarSizeChanged(false);
2308
2309 UpdatePermissionBubbleViewAnchor();
2294 } 2310 }
2295 2311
2296 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { 2312 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2297 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop 2313 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop
2298 // immersive fullscreen doesn't exist. 2314 // immersive fullscreen doesn't exist.
2299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || 2315 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) ||
2300 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { 2316 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) {
2301 return false; 2317 return false;
2302 } 2318 }
2303 2319
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 return immersive_mode_controller()->IsEnabled(); 2620 return immersive_mode_controller()->IsEnabled();
2605 } 2621 }
2606 2622
2607 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2623 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2608 return GetWidget(); 2624 return GetWidget();
2609 } 2625 }
2610 2626
2611 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2627 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2612 return top_container_->GetBoundsInScreen(); 2628 return top_container_->GetBoundsInScreen();
2613 } 2629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698