| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 items_.push_back(base::string16()); | 35 items_.push_back(base::string16()); |
| 36 | 36 |
| 37 // Menu items in the drop down menu. | 37 // Menu items in the drop down menu. |
| 38 items_.push_back(l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY)); | 38 items_.push_back(l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY)); |
| 39 items_.push_back(l10n_util::GetStringFUTF16( | 39 items_.push_back(l10n_util::GetStringFUTF16( |
| 40 IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, | 40 IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, |
| 41 original_language_name)); | 41 original_language_name)); |
| 42 items_.push_back(l10n_util::GetStringUTF16( | 42 items_.push_back(l10n_util::GetStringUTF16( |
| 43 IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE)); | 43 IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE)); |
| 44 } | 44 } |
| 45 virtual ~TranslateDenialComboboxModel() {} | 45 ~TranslateDenialComboboxModel() override {} |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // ComboboxModel: | 48 // ComboboxModel: |
| 49 virtual int GetItemCount() const override { | 49 int GetItemCount() const override { return items_.size(); } |
| 50 return items_.size(); | 50 base::string16 GetItemAt(int index) override { return items_[index]; } |
| 51 } | 51 bool IsItemSeparatorAt(int index) override { return false; } |
| 52 virtual base::string16 GetItemAt(int index) override { | 52 int GetDefaultIndex() const override { return 0; } |
| 53 return items_[index]; | |
| 54 } | |
| 55 virtual bool IsItemSeparatorAt(int index) override { | |
| 56 return false; | |
| 57 } | |
| 58 virtual int GetDefaultIndex() const override { | |
| 59 return 0; | |
| 60 } | |
| 61 | 53 |
| 62 std::vector<base::string16> items_; | 54 std::vector<base::string16> items_; |
| 63 | 55 |
| 64 DISALLOW_COPY_AND_ASSIGN(TranslateDenialComboboxModel); | 56 DISALLOW_COPY_AND_ASSIGN(TranslateDenialComboboxModel); |
| 65 }; | 57 }; |
| 66 | 58 |
| 67 const CGFloat kWindowWidth = 320; | 59 const CGFloat kWindowWidth = 320; |
| 68 | 60 |
| 69 // Padding between the window frame and content. | 61 // Padding between the window frame and content. |
| 70 const CGFloat kFramePadding = 16; | 62 const CGFloat kFramePadding = 16; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 [self updateAdvancedView]; | 638 [self updateAdvancedView]; |
| 647 } | 639 } |
| 648 | 640 |
| 649 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender { | 641 - (void)handleTargetLanguagePopUpButtonSelectedItemChanged:(id)sender { |
| 650 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender); | 642 NSPopUpButton* button = base::mac::ObjCCastStrict<NSPopUpButton>(sender); |
| 651 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]); | 643 model_->UpdateTargetLanguageIndex([button indexOfSelectedItem]); |
| 652 [self updateAdvancedView]; | 644 [self updateAdvancedView]; |
| 653 } | 645 } |
| 654 | 646 |
| 655 @end | 647 @end |
| OLD | NEW |