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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc

Issue 2808823002: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (Closed)
Patch Set: MacViews: Allows the toolkit-views Manage Passwords Dialog to be used (tests compile) Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
index 27543b4e2af1d075ea2066b1c7d8963483d8bd2a..8d344fe47de871e45cfdc9a03fe2dfe3d1928976 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
@@ -49,23 +49,23 @@ void LocationBarBubbleDelegateView::WebContentMouseHandler::OnTouchEvent(
LocationBarBubbleDelegateView::LocationBarBubbleDelegateView(
views::View* anchor_view,
+ const gfx::Point& anchor_point,
+ views::BubbleBorder::Arrow arrow,
+ content::WebContents* web_contents)
+ : BubbleDialogDelegateView(
+ anchor_view,
+ anchor_view ? views::BubbleBorder::TOP_RIGHT : arrow) {
+ SetupAnchor(anchor_view, anchor_point, arrow, web_contents);
+}
+
+LocationBarBubbleDelegateView::LocationBarBubbleDelegateView(
+ views::View* anchor_view,
content::WebContents* web_contents)
: BubbleDialogDelegateView(anchor_view,
tapted 2017/04/12 05:08:42 Can the overload just delegate to the other constr
varkha 2017/04/12 09:16:43 Done.
anchor_view ? views::BubbleBorder::TOP_RIGHT
: views::BubbleBorder::NONE) {
- // Add observer to close the bubble if the fullscreen state changes.
- if (web_contents) {
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
- registrar_.Add(
- this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
- content::Source<FullscreenController>(
- browser->exclusive_access_manager()->fullscreen_controller()));
- }
- // Compensate for built-in vertical padding in the anchor view's image.
- // In the case of Harmony, this is just compensating for the location bar's
- // border thickness, as the bubble's top border should overlap it.
- set_anchor_view_insets(gfx::Insets(
- GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
+ SetupAnchor(anchor_view, gfx::Point(), views::BubbleBorder::NONE,
+ web_contents);
}
LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {}
@@ -94,6 +94,31 @@ void LocationBarBubbleDelegateView::Observe(
CloseBubble();
}
+void LocationBarBubbleDelegateView::SetupAnchor(
+ views::View* anchor_view,
+ const gfx::Point& anchor_point,
+ views::BubbleBorder::Arrow arrow,
+ content::WebContents* web_contents) {
+ // Add observer to close the bubble if the fullscreen state changes.
+ if (web_contents) {
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
+ registrar_.Add(
+ this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
+ content::Source<FullscreenController>(
+ browser->exclusive_access_manager()->fullscreen_controller()));
+ }
+ if (!anchor_view) {
+ SetAnchorRect(gfx::Rect(anchor_point, gfx::Size()));
+ return;
+ }
+
+ // Compensate for built-in vertical padding in the anchor view's image.
+ // In the case of Harmony, this is just compensating for the location bar's
+ // border thickness, as the bubble's top border should overlap it.
+ set_anchor_view_insets(gfx::Insets(
+ GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
+}
+
void LocationBarBubbleDelegateView::CloseBubble() {
GetWidget()->Close();
}

Powered by Google App Engine
This is Rietveld 408576698