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

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

Issue 312233003: Add fade eliding for Views Labels; related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refine alignment check; minor additional cleanup. Created 6 years, 6 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/content_setting_bubble_contents.h" 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator 219 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator
220 i(bubble_content.popup_items.begin()); 220 i(bubble_content.popup_items.begin());
221 i != bubble_content.popup_items.end(); ++i) { 221 i != bubble_content.popup_items.end(); ++i) {
222 if (!bubble_content_empty) 222 if (!bubble_content_empty)
223 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 223 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
224 layout->StartRow(0, kPopupColumnSetId); 224 layout->StartRow(0, kPopupColumnSetId);
225 225
226 views::Link* link = new views::Link(base::UTF8ToUTF16(i->title)); 226 views::Link* link = new views::Link(base::UTF8ToUTF16(i->title));
227 link->set_listener(this); 227 link->set_listener(this);
228 link->SetElideBehavior(views::Label::ELIDE_IN_MIDDLE); 228 link->SetElideBehavior(gfx::ELIDE_MIDDLE);
229 popup_links_[link] = i - bubble_content.popup_items.begin(); 229 popup_links_[link] = i - bubble_content.popup_items.begin();
230 layout->AddView(new Favicon(i->image, this, link)); 230 layout->AddView(new Favicon(i->image, this, link));
231 layout->AddView(link); 231 layout->AddView(link);
232 bubble_content_empty = false; 232 bubble_content_empty = false;
233 } 233 }
234 } 234 }
235 235
236 const int indented_kSingleColumnSetId = 3; 236 const int indented_kSingleColumnSetId = 3;
237 // Insert a column set with greater indent. 237 // Insert a column set with greater indent.
238 views::ColumnSet* indented_single_column_set = 238 views::ColumnSet* indented_single_column_set =
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 int width = button->GetPreferredSize().width(); 472 int width = button->GetPreferredSize().width();
473 for (int i = 0; i < menu_model->GetItemCount(); ++i) { 473 for (int i = 0; i < menu_model->GetItemCount(); ++i) {
474 button->SetText(menu_model->GetLabelAt(i)); 474 button->SetText(menu_model->GetLabelAt(i));
475 width = std::max(width, button->GetPreferredSize().width()); 475 width = std::max(width, button->GetPreferredSize().width());
476 } 476 }
477 477
478 // Recover the title for the menu button. 478 // Recover the title for the menu button.
479 button->SetText(title); 479 button->SetText(title);
480 return width; 480 return width;
481 } 481 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698