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

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

Issue 2693803002: Fix position of permission bubbles anchored off the padlock. (Closed)
Patch Set: Share some logic Created 3 years, 10 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 #include "content/public/browser/render_frame_host.h" 117 #include "content/public/browser/render_frame_host.h"
118 #include "content/public/browser/render_view_host.h" 118 #include "content/public/browser/render_view_host.h"
119 #include "content/public/browser/render_widget_host_view.h" 119 #include "content/public/browser/render_widget_host_view.h"
120 #include "content/public/browser/user_metrics.h" 120 #include "content/public/browser/user_metrics.h"
121 #include "content/public/browser/web_contents.h" 121 #include "content/public/browser/web_contents.h"
122 #include "content/public/common/content_switches.h" 122 #include "content/public/common/content_switches.h"
123 #include "ui/accessibility/ax_node_data.h" 123 #include "ui/accessibility/ax_node_data.h"
124 #include "ui/base/accelerators/accelerator.h" 124 #include "ui/base/accelerators/accelerator.h"
125 #include "ui/base/hit_test.h" 125 #include "ui/base/hit_test.h"
126 #include "ui/base/l10n/l10n_util.h" 126 #include "ui/base/l10n/l10n_util.h"
127 #include "ui/base/material_design/material_design_controller.h"
128 #include "ui/base/resource/resource_bundle.h" 127 #include "ui/base/resource/resource_bundle.h"
129 #include "ui/base/theme_provider.h" 128 #include "ui/base/theme_provider.h"
130 #include "ui/content_accelerators/accelerator_util.h" 129 #include "ui/content_accelerators/accelerator_util.h"
131 #include "ui/display/screen.h" 130 #include "ui/display/screen.h"
132 #include "ui/events/event_utils.h" 131 #include "ui/events/event_utils.h"
133 #include "ui/gfx/canvas.h" 132 #include "ui/gfx/canvas.h"
134 #include "ui/gfx/color_utils.h" 133 #include "ui/gfx/color_utils.h"
135 #include "ui/gfx/geometry/rect_conversions.h" 134 #include "ui/gfx/geometry/rect_conversions.h"
136 #include "ui/gfx/scoped_canvas.h" 135 #include "ui/gfx/scoped_canvas.h"
137 #include "ui/native_theme/native_theme_dark_aura.h" 136 #include "ui/native_theme/native_theme_dark_aura.h"
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1267
1269 void BrowserView::UserChangedTheme() { 1268 void BrowserView::UserChangedTheme() {
1270 frame_->FrameTypeChanged(); 1269 frame_->FrameTypeChanged();
1271 } 1270 }
1272 1271
1273 void BrowserView::ShowWebsiteSettings( 1272 void BrowserView::ShowWebsiteSettings(
1274 Profile* profile, 1273 Profile* profile,
1275 content::WebContents* web_contents, 1274 content::WebContents* web_contents,
1276 const GURL& virtual_url, 1275 const GURL& virtual_url,
1277 const security_state::SecurityInfo& security_info) { 1276 const security_state::SecurityInfo& security_info) {
1278 views::View* popup_anchor = nullptr; 1277 views::View* anchor_view =
1279 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 1278 GetLocationBarView()->GetSecurityBubbleAnchorView();
Peter Kasting 2017/02/13 21:36:31 Nit: Shorter to either use auto: auto* anchor_vi
tapted 2017/02/14 04:00:27 Done.
1280 popup_anchor = toolbar_->location_bar(); 1279 WebsiteSettingsPopupView::ShowPopup(anchor_view, gfx::Rect(), profile,
1281 else
1282 popup_anchor = GetLocationBarView()->location_icon_view()->GetImageView();
1283
1284 WebsiteSettingsPopupView::ShowPopup(popup_anchor, gfx::Rect(), profile,
1285 web_contents, virtual_url, security_info); 1280 web_contents, virtual_url, security_info);
1286 } 1281 }
1287 1282
1288 void BrowserView::ShowAppMenu() { 1283 void BrowserView::ShowAppMenu() {
1289 if (!toolbar_->app_menu_button()) 1284 if (!toolbar_->app_menu_button())
1290 return; 1285 return;
1291 1286
1292 // Keep the top-of-window views revealed as long as the app menu is visible. 1287 // Keep the top-of-window views revealed as long as the app menu is visible.
1293 std::unique_ptr<ImmersiveRevealedLock> revealed_lock( 1288 std::unique_ptr<ImmersiveRevealedLock> revealed_lock(
1294 immersive_mode_controller_->GetRevealedLock( 1289 immersive_mode_controller_->GetRevealedLock(
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 return GetThemeProvider()->GetColor( 2006 return GetThemeProvider()->GetColor(
2012 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); 2007 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR);
2013 } 2008 }
2014 2009
2015 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { 2010 void BrowserView::InfoBarContainerStateChanged(bool is_animating) {
2016 ToolbarSizeChanged(is_animating); 2011 ToolbarSizeChanged(is_animating);
2017 } 2012 }
2018 2013
2019 bool BrowserView::DrawInfoBarArrows(int* x) const { 2014 bool BrowserView::DrawInfoBarArrows(int* x) const {
2020 if (x) { 2015 if (x) {
2021 gfx::Point anchor(toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2016 gfx::Point anchor(toolbar_->location_bar()->GetInfoBarAnchorPoint());
2022 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor); 2017 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor);
2023 *x = anchor.x(); 2018 *x = anchor.x();
2024 } 2019 }
2025 return true; 2020 return true;
2026 } 2021 }
2027 2022
2028 void BrowserView::InitViews() { 2023 void BrowserView::InitViews() {
2029 GetWidget()->AddObserver(this); 2024 GetWidget()->AddObserver(this);
2030 2025
2031 // Stow a pointer to this object onto the window handle so that we can get at 2026 // Stow a pointer to this object onto the window handle so that we can get at
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 2554
2560 app_modal::AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2555 app_modal::AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2561 } 2556 }
2562 2557
2563 int BrowserView::GetMaxTopInfoBarArrowHeight() { 2558 int BrowserView::GetMaxTopInfoBarArrowHeight() {
2564 int top_arrow_height = 0; 2559 int top_arrow_height = 0;
2565 // Only show the arrows when not in fullscreen and when there's no omnibox 2560 // Only show the arrows when not in fullscreen and when there's no omnibox
2566 // popup. 2561 // popup.
2567 if (!IsFullscreen() && 2562 if (!IsFullscreen() &&
2568 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2563 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2569 gfx::Point icon_bottom( 2564 gfx::Point icon_bottom(toolbar_->location_bar()->GetInfoBarAnchorPoint());
2570 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2571 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2565 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2572 gfx::Point infobar_top; 2566 gfx::Point infobar_top;
2573 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2567 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2574 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2568 top_arrow_height = infobar_top.y() - icon_bottom.y();
2575 } 2569 }
2576 return top_arrow_height; 2570 return top_arrow_height;
2577 } 2571 }
2578 2572
2579 /////////////////////////////////////////////////////////////////////////////// 2573 ///////////////////////////////////////////////////////////////////////////////
2580 // BrowserView, ExclusiveAccessContext implementation: 2574 // BrowserView, ExclusiveAccessContext implementation:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2631 }
2638 2632
2639 extensions::ActiveTabPermissionGranter* 2633 extensions::ActiveTabPermissionGranter*
2640 BrowserView::GetActiveTabPermissionGranter() { 2634 BrowserView::GetActiveTabPermissionGranter() {
2641 content::WebContents* web_contents = GetActiveWebContents(); 2635 content::WebContents* web_contents = GetActiveWebContents();
2642 if (!web_contents) 2636 if (!web_contents)
2643 return nullptr; 2637 return nullptr;
2644 return extensions::TabHelper::FromWebContents(web_contents) 2638 return extensions::TabHelper::FromWebContents(web_contents)
2645 ->active_tab_permission_granter(); 2639 ->active_tab_permission_granter();
2646 } 2640 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698