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

Side by Side Diff: chrome/browser/views/infobars/before_translate_infobar.cc

Issue 2873029: Fix a crasher with the translate infobar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/views/infobars/infobars.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/infobars/before_translate_infobar.h" 5 #include "chrome/browser/views/infobars/before_translate_infobar.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/translate/options_menu_model.h" 10 #include "chrome/browser/translate/options_menu_model.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 deny_button_->SetBounds( 89 deny_button_->SetBounds(
90 accept_button_->bounds().right() + InfoBar::kButtonButtonSpacing, 90 accept_button_->bounds().right() + InfoBar::kButtonButtonSpacing,
91 OffsetY(this, pref_size), pref_size.width(), pref_size.height()); 91 OffsetY(this, pref_size), pref_size.width(), pref_size.height());
92 } 92 }
93 93
94 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender, 94 void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender,
95 const views::Event& event) { 95 const views::Event& event) {
96 if (sender == accept_button_) { 96 if (sender == accept_button_) {
97 GetDelegate()->Translate(); 97 GetDelegate()->Translate();
98 } else if (sender == deny_button_) { 98 } else if (sender == deny_button_) {
99 Close(); 99 RemoveInfoBar();
100 } else { 100 } else {
101 TranslateInfoBarBase::ButtonPressed(sender, event); 101 TranslateInfoBarBase::ButtonPressed(sender, event);
102 } 102 }
103 } 103 }
104 104
105 void BeforeTranslateInfoBar::OriginalLanguageChanged() { 105 void BeforeTranslateInfoBar::OriginalLanguageChanged() {
106 UpdateOriginalButtonText(); 106 UpdateOriginalButtonText();
107 } 107 }
108 108
109 void BeforeTranslateInfoBar::TargetLanguageChanged() { 109 void BeforeTranslateInfoBar::TargetLanguageChanged() {
(...skipping 18 matching lines...) Expand all
128 void BeforeTranslateInfoBar::UpdateOriginalButtonText() { 128 void BeforeTranslateInfoBar::UpdateOriginalButtonText() {
129 string16 language = GetDelegate()->GetLanguageDisplayableNameAt( 129 string16 language = GetDelegate()->GetLanguageDisplayableNameAt(
130 GetDelegate()->original_language_index()); 130 GetDelegate()->original_language_index());
131 language_menu_button_->SetText(UTF16ToWideHack(language)); 131 language_menu_button_->SetText(UTF16ToWideHack(language));
132 // The following line is necessary for the preferred size to be recomputed. 132 // The following line is necessary for the preferred size to be recomputed.
133 language_menu_button_->ClearMaxTextSize(); 133 language_menu_button_->ClearMaxTextSize();
134 // The button may have to grow to show the new text. 134 // The button may have to grow to show the new text.
135 Layout(); 135 Layout();
136 SchedulePaint(); 136 SchedulePaint();
137 } 137 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/infobars/infobars.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698