| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" | 5 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 22 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 | 24 |
| 25 using InfoBarUtilities::MoveControl; | 25 using InfoBarUtilities::MoveControl; |
| 26 using InfoBarUtilities::VerticallyCenterView; | 26 using InfoBarUtilities::VerticallyCenterView; |
| 27 using InfoBarUtilities::VerifyControlOrderAndSpacing; | 27 using InfoBarUtilities::VerifyControlOrderAndSpacing; |
| 28 using InfoBarUtilities::CreateLabel; | 28 using InfoBarUtilities::CreateLabel; |
| 29 using InfoBarUtilities::AddMenuItem; | 29 using InfoBarUtilities::AddMenuItem; |
| 30 | 30 |
| 31 // TranslateInfoBarDelegate views specific method: | 31 // TranslateInfoBarDelegate views specific method: |
| 32 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { | 32 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 33 TranslateInfoBarControllerBase* infobar_controller = NULL; | 33 TranslateInfoBarControllerBase* infobar_controller = NULL; |
| 34 switch (type_) { | 34 switch (type_) { |
| 35 case BEFORE_TRANSLATE: | 35 case BEFORE_TRANSLATE: |
| 36 infobar_controller = | 36 infobar_controller = |
| 37 [[BeforeTranslateInfobarController alloc] initWithDelegate:this | 37 [[BeforeTranslateInfobarController alloc] initWithDelegate:this |
| 38 owner:owner]; | 38 owner:owner]; |
| 39 break; | 39 break; |
| 40 case AFTER_TRANSLATE: | 40 case AFTER_TRANSLATE: |
| 41 infobar_controller = | 41 infobar_controller = |
| 42 [[AfterTranslateInfobarController alloc] initWithDelegate:this | 42 [[AfterTranslateInfobarController alloc] initWithDelegate:this |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Completely rebuild "from" and "to" language menus from the data model. | 93 // Completely rebuild "from" and "to" language menus from the data model. |
| 94 - (void)populateLanguageMenus; | 94 - (void)populateLanguageMenus; |
| 95 | 95 |
| 96 @end | 96 @end |
| 97 | 97 |
| 98 #pragma mark TranslateInfoBarController class | 98 #pragma mark TranslateInfoBarController class |
| 99 | 99 |
| 100 @implementation TranslateInfoBarControllerBase | 100 @implementation TranslateInfoBarControllerBase |
| 101 | 101 |
| 102 - (id)initWithDelegate:(InfoBarDelegate*)delegate | 102 - (id)initWithDelegate:(InfoBarDelegate*)delegate |
| 103 owner:(InfoBarTabService*)owner { | 103 owner:(InfoBarService*)owner { |
| 104 if ((self = [super initWithDelegate:delegate owner:owner])) { | 104 if ((self = [super initWithDelegate:delegate owner:owner])) { |
| 105 originalLanguageMenuModel_.reset( | 105 originalLanguageMenuModel_.reset( |
| 106 new LanguagesMenuModel([self delegate], | 106 new LanguagesMenuModel([self delegate], |
| 107 LanguagesMenuModel::ORIGINAL)); | 107 LanguagesMenuModel::ORIGINAL)); |
| 108 | 108 |
| 109 targetLanguageMenuModel_.reset( | 109 targetLanguageMenuModel_.reset( |
| 110 new LanguagesMenuModel([self delegate], | 110 new LanguagesMenuModel([self delegate], |
| 111 LanguagesMenuModel::TARGET)); | 111 LanguagesMenuModel::TARGET)); |
| 112 } | 112 } |
| 113 return self; | 113 return self; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 [[control description] UTF8String] <<[title UTF8String]; | 575 [[control description] UTF8String] <<[title UTF8String]; |
| 576 return false; | 576 return false; |
| 577 } | 577 } |
| 578 previousControl = control; | 578 previousControl = control; |
| 579 } | 579 } |
| 580 | 580 |
| 581 return true; | 581 return true; |
| 582 } | 582 } |
| 583 | 583 |
| 584 @end // TranslateInfoBarControllerBase (TestingAPI) | 584 @end // TranslateInfoBarControllerBase (TestingAPI) |
| OLD | NEW |