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

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

Issue 594056: Translate Infobars for OS X. (Closed)
Patch Set: Fix review comments Created 10 years, 10 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
« no previous file with comments | « chrome/browser/translate/translate_infobars_delegates.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/translate_infobars.h" 5 #include "chrome/browser/views/infobars/translate_infobars.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 string16 new_language = TranslateInfoBarDelegate::GetDisplayNameForLocale( 713 string16 new_language = TranslateInfoBarDelegate::GetDisplayNameForLocale(
714 GetDelegate()->GetLocaleFromIndex(new_language_index)); 714 GetDelegate()->GetLocaleFromIndex(new_language_index));
715 menu_button->SetText(UTF16ToWideHack(new_language)); 715 menu_button->SetText(UTF16ToWideHack(new_language));
716 menu_button->ClearMaxTextSize(); 716 menu_button->ClearMaxTextSize();
717 menu_button->SizeToPreferredSize(); 717 menu_button->SizeToPreferredSize();
718 Layout(); 718 Layout();
719 SchedulePaint(); 719 SchedulePaint();
720 // Clear options menu model so that it'll be created with new language. 720 // Clear options menu model so that it'll be created with new language.
721 options_menu_model_.reset(); 721 options_menu_model_.reset();
722 // If necessary, trigger translation. 722 // Selecting an item from the "from language" menu in the before translate
723 // phase shouldn't trigger translation - http://crbug.com/36666
723 if (GetDelegate()->state() == TranslateInfoBarDelegate::kAfterTranslate) 724 if (GetDelegate()->state() == TranslateInfoBarDelegate::kAfterTranslate)
724 GetDelegate()->Translate(); 725 GetDelegate()->Translate();
725 } 726 }
726 727
727 inline TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() const { 728 inline TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() const {
728 return static_cast<TranslateInfoBarDelegate*>(delegate()); 729 return static_cast<TranslateInfoBarDelegate*>(delegate());
729 } 730 }
730 731
731 inline int TranslateInfoBar::GetSpacingAfterFirstLanguageButton() const { 732 inline int TranslateInfoBar::GetSpacingAfterFirstLanguageButton() const {
732 return (GetDelegate()->state() == TranslateInfoBarDelegate::kBeforeTranslate ? 733 return (GetDelegate()->state() == TranslateInfoBarDelegate::kBeforeTranslate ?
733 10 : kButtonInLabelSpacing); 734 10 : kButtonInLabelSpacing);
734 } 735 }
735 736
736 // TranslateInfoBarDelegate, InfoBarDelegate overrides: ------------------ 737 // TranslateInfoBarDelegate, InfoBarDelegate overrides: ------------------
737 738
738 InfoBar* TranslateInfoBarDelegate::CreateInfoBar() { 739 InfoBar* TranslateInfoBarDelegate::CreateInfoBar() {
739 return new TranslateInfoBar(this); 740 return new TranslateInfoBar(this);
740 } 741 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_infobars_delegates.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698