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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc

Issue 2380763002: Adjust positioning of website settings popup for Harmony. (Closed)
Patch Set: typo Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/location_bar/location_bar_bubble_delegate_view .h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 anchor_view ? views::BubbleBorder::TOP_RIGHT 54 anchor_view ? views::BubbleBorder::TOP_RIGHT
55 : views::BubbleBorder::NONE) { 55 : views::BubbleBorder::NONE) {
56 // Add observer to close the bubble if the fullscreen state changes. 56 // Add observer to close the bubble if the fullscreen state changes.
57 if (web_contents) { 57 if (web_contents) {
58 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 58 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
59 registrar_.Add( 59 registrar_.Add(
60 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, 60 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
61 content::Source<FullscreenController>( 61 content::Source<FullscreenController>(
62 browser->exclusive_access_manager()->fullscreen_controller())); 62 browser->exclusive_access_manager()->fullscreen_controller()));
63 } 63 }
64 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 64 // Compensate for built-in vertical padding in the anchor view's image.
65 // The anchor is the location bar. The bubble's 1px border should overlap 65 // In the case of Harmony, this is just compensating for the location bar's
66 // the location bar's 1px border. 66 // border thickness, as the bubble's top border should overlap it.
67 set_anchor_view_insets(gfx::Insets(0, 0, 1, 0)); 67 set_anchor_view_insets(gfx::Insets(
68 } else { 68 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
69 // Compensate for built-in vertical padding in the anchor view's image.
70 set_anchor_view_insets(gfx::Insets(
71 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
72 }
73 } 69 }
74 70
75 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {} 71 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {}
76 72
77 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) { 73 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) {
78 if (reason == USER_GESTURE) { 74 if (reason == USER_GESTURE) {
79 // In the USER_GESTURE case, the icon will be in an active state so the 75 // In the USER_GESTURE case, the icon will be in an active state so the
80 // bubble doesn't need an arrow. 76 // bubble doesn't need an arrow.
81 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); 77 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT);
82 GetWidget()->Show(); 78 GetWidget()->Show();
(...skipping 24 matching lines...) Expand all
107 if (GetAnchorView()) 103 if (GetAnchorView())
108 return; 104 return;
109 105
110 const int kBubblePaddingFromScreenEdge = 20; 106 const int kBubblePaddingFromScreenEdge = 20;
111 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; 107 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge;
112 const int x_pos = base::i18n::IsRTL() 108 const int x_pos = base::i18n::IsRTL()
113 ? (screen_bounds.x() + horizontal_offset) 109 ? (screen_bounds.x() + horizontal_offset)
114 : (screen_bounds.right() - horizontal_offset); 110 : (screen_bounds.right() - horizontal_offset);
115 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); 111 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0));
116 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698