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

Side by Side Diff: chrome/browser/ui/views/infobars/translate_message_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/translate_message_infobar.h" 5 #include "chrome/browser/ui/views/infobars/translate_message_infobar.h"
6 6
7 #include "chrome/browser/translate/translate_infobar_delegate.h" 7 #include "chrome/browser/translate/translate_infobar_delegate.h"
8 #include "ui/views/controls/button/label_button.h" 8 #include "ui/views/controls/button/label_button.h"
9 #include "ui/views/controls/label.h" 9 #include "ui/views/controls/label.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void TranslateMessageInfoBar::ButtonPressed(views::Button* sender, 54 void TranslateMessageInfoBar::ButtonPressed(views::Button* sender,
55 const ui::Event& event) { 55 const ui::Event& event) {
56 if (!owner()) 56 if (!owner())
57 return; // We're closing; don't call anything, it might access the owner. 57 return; // We're closing; don't call anything, it might access the owner.
58 if (sender == button_) 58 if (sender == button_)
59 GetDelegate()->MessageInfoBarButtonPressed(); 59 GetDelegate()->MessageInfoBarButtonPressed();
60 else 60 else
61 TranslateInfoBarBase::ButtonPressed(sender, event); 61 TranslateInfoBarBase::ButtonPressed(sender, event);
62 } 62 }
63 63
64 int TranslateMessageInfoBar::ContentMinimumWidth() { 64 int TranslateMessageInfoBar::ContentMinimumWidth() const {
65 return label_->GetMinimumSize().width() + NonLabelWidth(); 65 return label_->GetMinimumSize().width() + NonLabelWidth();
66 } 66 }
67 67
68 int TranslateMessageInfoBar::NonLabelWidth() const { 68 int TranslateMessageInfoBar::NonLabelWidth() const {
69 if (!button_) 69 if (!button_)
70 return 0; 70 return 0;
71 return button_->width() + (label_->text().empty() ? 0 : kEndOfLabelSpacing); 71 return button_->width() + (label_->text().empty() ? 0 : kEndOfLabelSpacing);
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698