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

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: fix ternary if-else (+respond to comments) 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 WebsiteSettingsPopupView::ShowPopup(
1279 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 1278 GetLocationBarView()->GetSecurityBubbleAnchorView(), gfx::Rect(), profile,
1280 popup_anchor = toolbar_->location_bar(); 1279 web_contents, virtual_url, security_info);
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);
1286 } 1280 }
1287 1281
1288 void BrowserView::ShowAppMenu() { 1282 void BrowserView::ShowAppMenu() {
1289 if (!toolbar_->app_menu_button()) 1283 if (!toolbar_->app_menu_button())
1290 return; 1284 return;
1291 1285
1292 // Keep the top-of-window views revealed as long as the app menu is visible. 1286 // Keep the top-of-window views revealed as long as the app menu is visible.
1293 std::unique_ptr<ImmersiveRevealedLock> revealed_lock( 1287 std::unique_ptr<ImmersiveRevealedLock> revealed_lock(
1294 immersive_mode_controller_->GetRevealedLock( 1288 immersive_mode_controller_->GetRevealedLock(
1295 ImmersiveModeController::ANIMATE_REVEAL_NO)); 1289 ImmersiveModeController::ANIMATE_REVEAL_NO));
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 return GetThemeProvider()->GetColor( 2005 return GetThemeProvider()->GetColor(
2012 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); 2006 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR);
2013 } 2007 }
2014 2008
2015 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { 2009 void BrowserView::InfoBarContainerStateChanged(bool is_animating) {
2016 ToolbarSizeChanged(is_animating); 2010 ToolbarSizeChanged(is_animating);
2017 } 2011 }
2018 2012
2019 bool BrowserView::DrawInfoBarArrows(int* x) const { 2013 bool BrowserView::DrawInfoBarArrows(int* x) const {
2020 if (x) { 2014 if (x) {
2021 gfx::Point anchor(toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2015 gfx::Point anchor(toolbar_->location_bar()->GetInfoBarAnchorPoint());
2022 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor); 2016 ConvertPointToTarget(toolbar_->location_bar(), this, &anchor);
2023 *x = anchor.x(); 2017 *x = anchor.x();
2024 } 2018 }
2025 return true; 2019 return true;
2026 } 2020 }
2027 2021
2028 void BrowserView::InitViews() { 2022 void BrowserView::InitViews() {
2029 GetWidget()->AddObserver(this); 2023 GetWidget()->AddObserver(this);
2030 2024
2031 // Stow a pointer to this object onto the window handle so that we can get at 2025 // 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 2553
2560 app_modal::AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2554 app_modal::AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2561 } 2555 }
2562 2556
2563 int BrowserView::GetMaxTopInfoBarArrowHeight() { 2557 int BrowserView::GetMaxTopInfoBarArrowHeight() {
2564 int top_arrow_height = 0; 2558 int top_arrow_height = 0;
2565 // Only show the arrows when not in fullscreen and when there's no omnibox 2559 // Only show the arrows when not in fullscreen and when there's no omnibox
2566 // popup. 2560 // popup.
2567 if (!IsFullscreen() && 2561 if (!IsFullscreen() &&
2568 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2562 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2569 gfx::Point icon_bottom( 2563 gfx::Point icon_bottom(toolbar_->location_bar()->GetInfoBarAnchorPoint());
2570 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2571 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2564 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2572 gfx::Point infobar_top; 2565 gfx::Point infobar_top;
2573 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2566 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2574 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2567 top_arrow_height = infobar_top.y() - icon_bottom.y();
2575 } 2568 }
2576 return top_arrow_height; 2569 return top_arrow_height;
2577 } 2570 }
2578 2571
2579 /////////////////////////////////////////////////////////////////////////////// 2572 ///////////////////////////////////////////////////////////////////////////////
2580 // BrowserView, ExclusiveAccessContext implementation: 2573 // BrowserView, ExclusiveAccessContext implementation:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2630 }
2638 2631
2639 extensions::ActiveTabPermissionGranter* 2632 extensions::ActiveTabPermissionGranter*
2640 BrowserView::GetActiveTabPermissionGranter() { 2633 BrowserView::GetActiveTabPermissionGranter() {
2641 content::WebContents* web_contents = GetActiveWebContents(); 2634 content::WebContents* web_contents = GetActiveWebContents();
2642 if (!web_contents) 2635 if (!web_contents)
2643 return nullptr; 2636 return nullptr;
2644 return extensions::TabHelper::FromWebContents(web_contents) 2637 return extensions::TabHelper::FromWebContents(web_contents)
2645 ->active_tab_permission_granter(); 2638 ->active_tab_permission_granter();
2646 } 2639 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698