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

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: Fix issue 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(
groby-ooo-7-16 2015/02/28 00:25:12 I'm still not sure why we need to pre-create |perm
hcarmona 2015/02/28 01:14:16 We can probably update the code to create it only
546 GetLocationBarView()->location_icon_view(), languages)); 544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)));
545 UpdatePermissionBubbleView();
546 }
547
548 void BrowserView::UpdatePermissionBubbleView() {
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 permission_bubble_view_->SetAnchor(
555 top_container_,
556 views::BubbleBorder::NONE);
557 }
547 } 558 }
548 559
549 gfx::Rect BrowserView::GetToolbarBounds() const { 560 gfx::Rect BrowserView::GetToolbarBounds() const {
550 gfx::Rect toolbar_bounds(toolbar_->bounds()); 561 gfx::Rect toolbar_bounds(toolbar_->bounds());
551 if (toolbar_bounds.IsEmpty()) 562 if (toolbar_bounds.IsEmpty())
552 return toolbar_bounds; 563 return toolbar_bounds;
553 // The apparent toolbar edges are outside the "real" toolbar edges. 564 // The apparent toolbar edges are outside the "real" toolbar edges.
554 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); 565 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
555 return toolbar_bounds; 566 return toolbar_bounds;
556 } 567 }
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 } 2295 }
2285 2296
2286 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2297 // 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 2298 // recompute the height of the infobar top arrow because toggling in and out
2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2299 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2289 // things since it computes the arrow height directly and forces a layout 2300 // things since it computes the arrow height directly and forces a layout
2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in 2301 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in
2291 // order to let the layout occur. 2302 // order to let the layout occur.
2292 in_process_fullscreen_ = false; 2303 in_process_fullscreen_ = false;
2293 ToolbarSizeChanged(false); 2304 ToolbarSizeChanged(false);
2305
2306 UpdatePermissionBubbleView();
groby-ooo-7-16 2015/02/28 00:25:12 Doesn't fullscreen mode imply a focus change, and
hcarmona 2015/02/28 01:14:16 The permission bubbles remain visible even when fo
felt 2015/03/03 01:04:35 No, we should not hide or move the permission bubb
2294 } 2307 }
2295 2308
2296 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { 2309 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2297 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop 2310 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop
2298 // immersive fullscreen doesn't exist. 2311 // immersive fullscreen doesn't exist.
2299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || 2312 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) ||
2300 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { 2313 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) {
2301 return false; 2314 return false;
2302 } 2315 }
2303 2316
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2574 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2562 gfx::Point icon_bottom( 2575 gfx::Point icon_bottom(
2563 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2576 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2564 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2577 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2565 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2578 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2566 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2579 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2567 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2580 top_arrow_height = infobar_top.y() - icon_bottom.y();
2568 } 2581 }
2569 return top_arrow_height; 2582 return top_arrow_height;
2570 } 2583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698