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

Side by Side Diff: chrome/browser/ui/views/infobars/before_translate_infobar.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/infobars/before_translate_infobar.h" 5 #include "chrome/browser/ui/views/infobars/before_translate_infobar.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/translate/options_menu_model.h" 8 #include "chrome/browser/translate/options_menu_model.h"
9 #include "chrome/browser/translate/translate_infobar_delegate.h" 9 #include "chrome/browser/translate/translate_infobar_delegate.h"
10 #include "chrome/browser/ui/views/infobars/translate_language_menu_model.h" 10 #include "chrome/browser/ui/views/infobars/translate_language_menu_model.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // the close button is the last child. 132 // the close button is the last child.
133 TranslateInfoBarBase::ViewHierarchyChanged(details); 133 TranslateInfoBarBase::ViewHierarchyChanged(details);
134 134
135 // This must happen after adding all children because it triggers layout, 135 // This must happen after adding all children because it triggers layout,
136 // which assumes that particular children (e.g. the close button) have already 136 // which assumes that particular children (e.g. the close button) have already
137 // been added. 137 // been added.
138 UpdateLanguageButtonText(language_menu_button_, 138 UpdateLanguageButtonText(language_menu_button_,
139 delegate->language_name_at(delegate->original_language_index())); 139 delegate->language_name_at(delegate->original_language_index()));
140 } 140 }
141 141
142 int BeforeTranslateInfoBar::ContentMinimumWidth() { 142 int BeforeTranslateInfoBar::ContentMinimumWidth() const {
143 return label_1_->GetMinimumSize().width() + 143 return label_1_->GetMinimumSize().width() +
144 label_2_->GetMinimumSize().width() + NonLabelWidth(); 144 label_2_->GetMinimumSize().width() + NonLabelWidth();
145 } 145 }
146 146
147 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender, 147 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender,
148 const ui::Event& event) { 148 const ui::Event& event) {
149 if (!owner()) 149 if (!owner())
150 return; // We're closing; don't call anything, it might access the owner. 150 return; // We're closing; don't call anything, it might access the owner.
151 TranslateInfoBarDelegate* delegate = GetDelegate(); 151 TranslateInfoBarDelegate* delegate = GetDelegate();
152 if (sender == accept_button_) { 152 if (sender == accept_button_) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 language_menu_button_->width() + 184 language_menu_button_->width() +
185 (label_2_->text().empty() ? 0 : kButtonInLabelSpacing) + 185 (label_2_->text().empty() ? 0 : kButtonInLabelSpacing) +
186 kEndOfLabelSpacing + accept_button_->width() + kButtonButtonSpacing + 186 kEndOfLabelSpacing + accept_button_->width() + kButtonButtonSpacing +
187 deny_button_->width() + 187 deny_button_->width() +
188 (never_translate_button_ ? 188 (never_translate_button_ ?
189 (kButtonButtonSpacing + never_translate_button_->width()) : 0) + 189 (kButtonButtonSpacing + never_translate_button_->width()) : 0) +
190 (always_translate_button_ ? 190 (always_translate_button_ ?
191 (kButtonButtonSpacing + always_translate_button_->width()) : 0) + 191 (kButtonButtonSpacing + always_translate_button_->width()) : 0) +
192 kEndOfLabelSpacing + options_menu_button_->width(); 192 kEndOfLabelSpacing + options_menu_button_->width();
193 } 193 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/before_translate_infobar.h ('k') | chrome/browser/ui/views/infobars/confirm_infobar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698