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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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 | Annotate | Revision Log
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/ev_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
6 #include "grit/theme_resources.h" 6 #include "grit/theme_resources.h"
7 #include "ui/views/controls/label.h" 7 #include "ui/views/controls/label.h"
8 #include "ui/views/painter.h" 8 #include "ui/views/painter.h"
9 9
10 10
11 namespace { 11 namespace {
12 const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); 12 const int kBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE);
13 } 13 }
14 14
15 15
16 EVBubbleView::EVBubbleView(const gfx::FontList& font_list, 16 EVBubbleView::EVBubbleView(const gfx::FontList& font_list,
17 SkColor text_color, 17 SkColor text_color,
18 SkColor parent_background_color, 18 SkColor parent_background_color,
19 LocationBarView* location_bar) 19 LocationBarView* location_bar)
20 : IconLabelBubbleView(kBackgroundImages, NULL, IDR_OMNIBOX_HTTPS_VALID, 20 : IconLabelBubbleView(kBackgroundImages, NULL, IDR_OMNIBOX_HTTPS_VALID,
21 font_list, text_color, parent_background_color, true), 21 font_list, text_color, parent_background_color, true),
22 page_info_helper_(this, location_bar) { 22 page_info_helper_(this, location_bar) {
23 } 23 }
24 24
25 EVBubbleView::~EVBubbleView() { 25 EVBubbleView::~EVBubbleView() {
26 } 26 }
27 27
28 gfx::Size EVBubbleView::GetMinimumSize() { 28 gfx::Size EVBubbleView::GetMinimumSize() const {
29 return GetMinimumSizeForPreferredSize(GetPreferredSize()); 29 return GetMinimumSizeForPreferredSize(GetPreferredSize());
30 } 30 }
31 31
32 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) { 32 bool EVBubbleView::OnMousePressed(const ui::MouseEvent& event) {
33 // We want to show the dialog on mouse release; that is the standard behavior 33 // We want to show the dialog on mouse release; that is the standard behavior
34 // for buttons. 34 // for buttons.
35 return true; 35 return true;
36 } 36 }
37 37
38 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) { 38 void EVBubbleView::OnMouseReleased(const ui::MouseEvent& event) {
(...skipping 13 matching lines...) Expand all
52 return GetMinimumSizeForPreferredSize( 52 return GetMinimumSizeForPreferredSize(
53 GetSizeForLabelWidth(label.GetPreferredSize().width())); 53 GetSizeForLabelWidth(label.GetPreferredSize().width()));
54 } 54 }
55 55
56 gfx::Size EVBubbleView::GetMinimumSizeForPreferredSize(gfx::Size size) const { 56 gfx::Size EVBubbleView::GetMinimumSizeForPreferredSize(gfx::Size size) const {
57 const int kMinCharacters = 10; 57 const int kMinCharacters = 10;
58 size.SetToMin( 58 size.SetToMin(
59 GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters))); 59 GetSizeForLabelWidth(font_list().GetExpectedTextWidth(kMinCharacters)));
60 return size; 60 return size;
61 } 61 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/ev_bubble_view.h ('k') | chrome/browser/ui/views/location_bar/icon_label_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698