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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/toolbar/toolbar_actions_bar_bubble_views.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
6 6
7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h" 7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
8 #include "chrome/browser/ui/view_ids.h" 8 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/grit/locale_settings.h" 9 #include "chrome/grit/locale_settings.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 content_label->SetMultiLine(true); 115 content_label->SetMultiLine(true);
116 int width = views::Widget::GetLocalizedContentsWidth( 116 int width = views::Widget::GetLocalizedContentsWidth(
117 IDS_EXTENSION_TOOLBAR_REDESIGN_NOTIFICATION_BUBBLE_WIDTH_CHARS); 117 IDS_EXTENSION_TOOLBAR_REDESIGN_NOTIFICATION_BUBBLE_WIDTH_CHARS);
118 content_label->SizeToFit(width); 118 content_label->SizeToFit(width);
119 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 119 content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
120 AddChildView(content_label); 120 AddChildView(content_label);
121 121
122 base::string16 item_list = delegate_->GetItemListText(); 122 base::string16 item_list = delegate_->GetItemListText();
123 if (!item_list.empty()) { 123 if (!item_list.empty()) {
124 item_list_ = new views::Label(item_list); 124 item_list_ = new views::Label(item_list);
125 item_list_->SetBorder( 125 item_list_->SetBorder(views::CreateEmptyBorder(0, kListPadding, 0, 0));
126 views::Border::CreateEmptyBorder(0, kListPadding, 0, 0));
127 item_list_->SetMultiLine(true); 126 item_list_->SetMultiLine(true);
128 item_list_->SizeToFit(width); 127 item_list_->SizeToFit(width);
129 item_list_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 128 item_list_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
130 AddChildView(item_list_); 129 AddChildView(item_list_);
131 } 130 }
132 } 131 }
133 132
134 int ToolbarActionsBarBubbleViews::GetDialogButtons() const { 133 int ToolbarActionsBarBubbleViews::GetDialogButtons() const {
135 int buttons = ui::DIALOG_BUTTON_NONE; 134 int buttons = ui::DIALOG_BUTTON_NONE;
136 if (!delegate_->GetActionButtonText().empty()) 135 if (!delegate_->GetActionButtonText().empty())
(...skipping 15 matching lines...) Expand all
152 : delegate_->GetDismissButtonText(); 151 : delegate_->GetDismissButtonText();
153 } 152 }
154 153
155 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link, 154 void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link,
156 int event_flags) { 155 int event_flags) {
157 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE); 156 delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE);
158 // Reset delegate so we don't send extra OnBubbleClosed()s. 157 // Reset delegate so we don't send extra OnBubbleClosed()s.
159 delegate_.reset(); 158 delegate_.reset();
160 GetWidget()->Close(); 159 GetWidget()->Close();
161 } 160 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | chrome/browser/ui/views/website_settings/website_settings_popup_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698