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

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

Issue 962013002: Left align bubble title and text, adjusted spacing between. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 (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/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/global_error/global_error.h" 10 #include "chrome/browser/ui/global_error/global_error.h"
(...skipping 17 matching lines...) Expand all
28 enum { 28 enum {
29 TAG_ACCEPT_BUTTON = 1, 29 TAG_ACCEPT_BUTTON = 1,
30 TAG_CANCEL_BUTTON, 30 TAG_CANCEL_BUTTON,
31 }; 31 };
32 32
33 const int kMaxBubbleViewWidth = 262; 33 const int kMaxBubbleViewWidth = 262;
34 34
35 // The vertical inset of the wrench bubble anchor from the wrench menu button. 35 // The vertical inset of the wrench bubble anchor from the wrench menu button.
36 const int kAnchorVerticalInset = 5; 36 const int kAnchorVerticalInset = 5;
37 37
38 const int kBubblePadding = 6; 38 // Align bubble text with the title.
39 const int kBubbleLeftPadding = 19;
40
41 const int kBubblePadding = 11;
msw 2015/02/27 03:25:50 nit: this should just be 19px or 20px and combined
xiaoling 2015/02/27 18:00:38 Done.
39 42
40 } // namespace 43 } // namespace
41 44
42 // GlobalErrorBubbleViewBase --------------------------------------------------- 45 // GlobalErrorBubbleViewBase ---------------------------------------------------
43 46
44 // static 47 // static
45 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView( 48 GlobalErrorBubbleViewBase* GlobalErrorBubbleViewBase::ShowStandardBubbleView(
46 Browser* browser, 49 Browser* browser,
47 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) { 50 const base::WeakPtr<GlobalErrorWithStandardBubble>& error) {
48 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 51 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 if (!cancel_string.empty()) { 102 if (!cancel_string.empty()) {
100 cancel_button.reset(new views::LabelButton(this, cancel_string)); 103 cancel_button.reset(new views::LabelButton(this, cancel_string));
101 cancel_button->SetStyle(views::Button::STYLE_BUTTON); 104 cancel_button->SetStyle(views::Button::STYLE_BUTTON);
102 cancel_button->set_tag(TAG_CANCEL_BUTTON); 105 cancel_button->set_tag(TAG_CANCEL_BUTTON);
103 } 106 }
104 107
105 views::GridLayout* layout = new views::GridLayout(this); 108 views::GridLayout* layout = new views::GridLayout(this);
106 SetLayoutManager(layout); 109 SetLayoutManager(layout);
107 110
108 // BubbleFrameView adds enough padding below title, no top padding needed. 111 // BubbleFrameView adds enough padding below title, no top padding needed.
109 layout->SetInsets(0, kBubblePadding, kBubblePadding, kBubblePadding); 112 set_margins(gfx::Insets(0, kBubbleLeftPadding,
113 kBubblePadding, kBubblePadding));
xiaoling 2015/02/27 02:59:34 I thought I have moved set_margins to the top of t
msw 2015/02/27 03:25:50 Acknowledged.
110 114
111 // First row, message labels. 115 // First row, message labels.
112 views::ColumnSet* cs = layout->AddColumnSet(0); 116 views::ColumnSet* cs = layout->AddColumnSet(0);
113 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 117 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
114 1, views::GridLayout::USE_PREF, 0, 0); 118 1, views::GridLayout::USE_PREF, 0, 0);
115 119
116 // Second row, accept and cancel button. 120 // Second row, accept and cancel button.
117 cs = layout->AddColumnSet(1); 121 cs = layout->AddColumnSet(1);
118 cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing); 122 cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing);
119 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, 123 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING,
120 0, views::GridLayout::USE_PREF, 0, 0); 124 0, views::GridLayout::USE_PREF, 0, 0);
121 if (cancel_button.get()) { 125 if (cancel_button.get()) {
122 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing); 126 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
123 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, 127 cs->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING,
124 0, views::GridLayout::USE_PREF, 0, 0); 128 0, views::GridLayout::USE_PREF, 0, 0);
125 } 129 }
126 130
127 for (size_t i = 0; i < message_labels.size(); ++i) { 131 for (size_t i = 0; i < message_labels.size(); ++i) {
128 layout->StartRow(1, 0); 132 layout->StartRow(1, 0);
129 layout->AddView(message_labels[i]); 133 layout->AddView(message_labels[i]);
130 if (i < message_labels.size() - 1) 134 if (i < message_labels.size() - 1)
131 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 135 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
132 } 136 }
133 layout->AddPaddingRow(0, views::kLabelToControlVerticalSpacing); 137 layout->AddPaddingRow(0, views::kLabelToControlVerticalSpacing);
msw 2015/02/27 03:25:50 I think this 8px padding between the message and t
xiaoling 2015/02/27 18:00:38 Done.
134 138
135 layout->StartRow(0, 1); 139 layout->StartRow(0, 1);
136 layout->AddView(accept_button.release()); 140 layout->AddView(accept_button.release());
137 if (cancel_button.get()) 141 if (cancel_button.get())
138 layout->AddView(cancel_button.release()); 142 layout->AddView(cancel_button.release());
139 143
140 // Adjust the message label size in case buttons are too long. 144 // Adjust the message label size in case buttons are too long.
141 for (size_t i = 0; i < message_labels.size(); ++i) 145 for (size_t i = 0; i < message_labels.size(); ++i)
142 message_labels[i]->SizeToFit(layout->GetPreferredSize(this).width()); 146 message_labels[i]->SizeToFit(layout->GetPreferredSize(this).width());
143 147
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 error_->BubbleViewDidClose(browser_); 189 error_->BubbleViewDidClose(browser_);
186 } 190 }
187 191
188 bool GlobalErrorBubbleView::ShouldShowCloseButton() const { 192 bool GlobalErrorBubbleView::ShouldShowCloseButton() const {
189 return error_ && error_->ShouldShowCloseButton(); 193 return error_ && error_->ShouldShowCloseButton();
190 } 194 }
191 195
192 void GlobalErrorBubbleView::CloseBubbleView() { 196 void GlobalErrorBubbleView::CloseBubbleView() {
193 GetWidget()->Close(); 197 GetWidget()->Close();
194 } 198 }
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