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

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

Issue 1758983002: [MD] Remove arrow from location bar bubbles when icon is already showing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
12 #include "ui/base/material_design/material_design_controller.h"
12 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
13 14
14 LocationBarBubbleDelegateView::LocationBarBubbleDelegateView( 15 LocationBarBubbleDelegateView::LocationBarBubbleDelegateView(
15 views::View* anchor_view, 16 views::View* anchor_view,
16 content::WebContents* web_contents) 17 content::WebContents* web_contents)
17 : BubbleDelegateView(anchor_view, 18 : BubbleDelegateView(anchor_view,
18 anchor_view ? views::BubbleBorder::TOP_RIGHT 19 anchor_view ? views::BubbleBorder::TOP_RIGHT
19 : views::BubbleBorder::NONE) { 20 : views::BubbleBorder::NONE) {
20 // Add observer to close the bubble if the fullscreen state changes. 21 // Add observer to close the bubble if the fullscreen state changes.
21 if (web_contents) { 22 if (web_contents) {
22 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 23 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
23 registrar_.Add( 24 registrar_.Add(
24 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, 25 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
25 content::Source<FullscreenController>( 26 content::Source<FullscreenController>(
26 browser->exclusive_access_manager()->fullscreen_controller())); 27 browser->exclusive_access_manager()->fullscreen_controller()));
27 } 28 }
28 } 29 }
29 30
30 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {} 31 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {}
31 32
32 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) { 33 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) {
33 if (reason == USER_GESTURE) { 34 if (reason == USER_GESTURE) {
34 // TODO(estade): re-enable this when crbug.com/518941 is fixed. 35 // In the USER_GESTURE case, the icon will be in an active state so the
35 // SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); 36 // bubble doesn't need an arrow.
37 if (ui::MaterialDesignController::IsModeMaterial())
38 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT);
varkha 2016/03/03 22:52:47 Do you need to do something similar here: https://
varkha 2016/03/04 00:59:57 Posted a CL here: https://codereview.chromium.org/
36 GetWidget()->Show(); 39 GetWidget()->Show();
37 } else { 40 } else {
38 GetWidget()->ShowInactive(); 41 GetWidget()->ShowInactive();
39 } 42 }
40 } 43 }
41 44
42 void LocationBarBubbleDelegateView::Observe( 45 void LocationBarBubbleDelegateView::Observe(
43 int type, 46 int type,
44 const content::NotificationSource& source, 47 const content::NotificationSource& source,
45 const content::NotificationDetails& details) { 48 const content::NotificationDetails& details) {
(...skipping 13 matching lines...) Expand all
59 if (GetAnchorView()) 62 if (GetAnchorView())
60 return; 63 return;
61 64
62 const int kBubblePaddingFromScreenEdge = 20; 65 const int kBubblePaddingFromScreenEdge = 20;
63 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; 66 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge;
64 const int x_pos = base::i18n::IsRTL() 67 const int x_pos = base::i18n::IsRTL()
65 ? (screen_bounds.x() + horizontal_offset) 68 ? (screen_bounds.x() + horizontal_offset)
66 : (screen_bounds.right() - horizontal_offset); 69 : (screen_bounds.right() - horizontal_offset);
67 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); 70 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0));
68 } 71 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698