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

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

Issue 1627543002: Anchor the infobar arrow to the LocationIconView correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkasting feedback Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/layout_constants.h" 8 #include "chrome/browser/ui/layout_constants.h"
9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
10 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Height will be ignored by the LocationBarView. 106 // Height will be ignored by the LocationBarView.
107 return GetSizeForLabelWidth(label_->GetPreferredSize().width()); 107 return GetSizeForLabelWidth(label_->GetPreferredSize().width());
108 } 108 }
109 109
110 void IconLabelBubbleView::Layout() { 110 void IconLabelBubbleView::Layout() {
111 // In MD mode, both extension icons and Chrome-provided icons are 16px, 111 // In MD mode, both extension icons and Chrome-provided icons are 16px,
112 // so it's not necessary to handle them differently. TODO(estade): clean 112 // so it's not necessary to handle them differently. TODO(estade): clean
113 // this up when MD is on by default. 113 // this up when MD is on by default.
114 bool icon_has_enough_padding = 114 bool icon_has_enough_padding =
115 !is_extension_icon_ || ui::MaterialDesignController::IsModeMaterial(); 115 !is_extension_icon_ || ui::MaterialDesignController::IsModeMaterial();
116 const int image_width = image()->GetPreferredSize().width(); 116 const int image_width = image_->GetPreferredSize().width();
117 image_->SetBounds(std::min((width() - image_width) / 2, 117 image_->SetBounds(std::min((width() - image_width) / 2,
118 GetBubbleOuterPadding(icon_has_enough_padding)), 118 GetBubbleOuterPadding(icon_has_enough_padding)),
119 0, image_->GetPreferredSize().width(), height()); 119 0, image_->GetPreferredSize().width(), height());
120 120
121 int pre_label_width = GetBubbleOuterPadding(true) + GetImageAndPaddingWidth(); 121 int pre_label_width = GetBubbleOuterPadding(true) + GetImageAndPaddingWidth();
122 label_->SetBounds(pre_label_width, 0, 122 label_->SetBounds(pre_label_width, 0,
123 width() - pre_label_width - GetBubbleOuterPadding(false), 123 width() - pre_label_width - GetBubbleOuterPadding(false),
124 height()); 124 height());
125 } 125 }
126 126
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { 199 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) {
200 if (!ShouldShowBackground()) 200 if (!ShouldShowBackground())
201 return; 201 return;
202 if (background_painter_) 202 if (background_painter_)
203 background_painter_->Paint(canvas, size()); 203 background_painter_->Paint(canvas, size());
204 if (background()) 204 if (background())
205 background()->Paint(canvas, this); 205 background()->Paint(canvas, this);
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698