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

Side by Side Diff: chrome/browser/ui/views/validation_message_bubble_view.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/validation_message_bubble_view.h" 5 #include "chrome/browser/ui/views/validation_message_bubble_view.h"
6 6
7 #include "chrome/grit/theme_resources.h" 7 #include "chrome/grit/theme_resources.h"
8 #include "content/public/browser/render_widget_host.h" 8 #include "content/public/browser/render_widget_host.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 24 matching lines...) Expand all
35 set_arrow(views::BubbleBorder::TOP_LEFT); 35 set_arrow(views::BubbleBorder::TOP_LEFT);
36 SetAnchorRect( 36 SetAnchorRect(
37 RootViewToScreenRect(anchor_in_root_view, render_widget_host_view)); 37 RootViewToScreenRect(anchor_in_root_view, render_widget_host_view));
38 38
39 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 39 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
40 views::ImageView* icon = new views::ImageView(); 40 views::ImageView* icon = new views::ImageView();
41 icon->SetImage(*bundle.GetImageSkiaNamed(IDR_INPUT_ALERT)); 41 icon->SetImage(*bundle.GetImageSkiaNamed(IDR_INPUT_ALERT));
42 icon->SizeToPreferredSize(); 42 icon->SizeToPreferredSize();
43 AddChildView(icon); 43 AddChildView(icon);
44 44
45 views::Label* label = new views::Label( 45 // TODO(tapted): Move |main_text| to WidgetDelegate::GetWindowTitle().
46 main_text, bundle.GetFontList(ui::ResourceBundle::MediumFont)); 46 views::Label* label =
47 new views::Label(main_text, views::style::CONTEXT_DIALOG_TITLE);
47 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 48 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
48 int text_start_x = icon->bounds().right() + kIconTextMargin; 49 int text_start_x = icon->bounds().right() + kIconTextMargin;
49 int min_available = kWindowMinWidth - text_start_x; 50 int min_available = kWindowMinWidth - text_start_x;
50 int max_available = kWindowMaxWidth - text_start_x; 51 int max_available = kWindowMaxWidth - text_start_x;
51 int label_width = label->GetPreferredSize().width(); 52 int label_width = label->GetPreferredSize().width();
52 label->SetMultiLine(true); 53 label->SetMultiLine(true);
53 AddChildView(label); 54 AddChildView(label);
54 55
55 views::Label* sub_label = nullptr; 56 views::Label* sub_label = nullptr;
56 if (!sub_text.empty()) { 57 if (!sub_text.empty()) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void ValidationMessageBubbleView::SetPositionRelativeToAnchor( 103 void ValidationMessageBubbleView::SetPositionRelativeToAnchor(
103 content::RenderWidgetHost* widget_host, 104 content::RenderWidgetHost* widget_host,
104 const gfx::Rect& anchor_in_root_view) { 105 const gfx::Rect& anchor_in_root_view) {
105 SetAnchorRect( 106 SetAnchorRect(
106 RootViewToScreenRect(anchor_in_root_view, widget_host->GetView())); 107 RootViewToScreenRect(anchor_in_root_view, widget_host->GetView()));
107 } 108 }
108 109
109 void ValidationMessageBubbleView::CloseValidationMessage() { 110 void ValidationMessageBubbleView::CloseValidationMessage() {
110 GetWidget()->Close(); 111 GetWidget()->Close();
111 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698