| 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(InfoBarTabHelper* owner) { | 32 InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarTabService* owner) { |
| 33 InfoBarTabHelper* helper = (InfoBarTabHelper*)owner; |
| 33 TranslateInfoBarControllerBase* infobar_controller = NULL; | 34 TranslateInfoBarControllerBase* infobar_controller = NULL; |
| 34 switch (type_) { | 35 switch (type_) { |
| 35 case BEFORE_TRANSLATE: | 36 case BEFORE_TRANSLATE: |
| 36 infobar_controller = | 37 infobar_controller = |
| 37 [[BeforeTranslateInfobarController alloc] initWithDelegate:this | 38 [[BeforeTranslateInfobarController alloc] initWithDelegate:this |
| 38 owner:owner]; | 39 owner:helper]; |
| 39 break; | 40 break; |
| 40 case AFTER_TRANSLATE: | 41 case AFTER_TRANSLATE: |
| 41 infobar_controller = | 42 infobar_controller = |
| 42 [[AfterTranslateInfobarController alloc] initWithDelegate:this | 43 [[AfterTranslateInfobarController alloc] initWithDelegate:this |
| 43 owner:owner]; | 44 owner:helper]; |
| 44 break; | 45 break; |
| 45 case TRANSLATING: | 46 case TRANSLATING: |
| 46 case TRANSLATION_ERROR: | 47 case TRANSLATION_ERROR: |
| 47 infobar_controller = | 48 infobar_controller = |
| 48 [[TranslateMessageInfobarController alloc] initWithDelegate:this | 49 [[TranslateMessageInfobarController alloc] initWithDelegate:this |
| 49 owner:owner]; | 50 owner:helper]; |
| 50 break; | 51 break; |
| 51 default: | 52 default: |
| 52 NOTREACHED(); | 53 NOTREACHED(); |
| 53 } | 54 } |
| 54 return new InfoBar(infobar_controller, this); | 55 return new InfoBar(infobar_controller, this); |
| 55 } | 56 } |
| 56 | 57 |
| 57 @implementation TranslateInfoBarControllerBase (FrameChangeObserver) | 58 @implementation TranslateInfoBarControllerBase (FrameChangeObserver) |
| 58 | 59 |
| 59 // Triggered when the frame changes. This will figure out what size and | 60 // Triggered when the frame changes. This will figure out what size and |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 [[control description] UTF8String] <<[title UTF8String]; | 576 [[control description] UTF8String] <<[title UTF8String]; |
| 576 return false; | 577 return false; |
| 577 } | 578 } |
| 578 previousControl = control; | 579 previousControl = control; |
| 579 } | 580 } |
| 580 | 581 |
| 581 return true; | 582 return true; |
| 582 } | 583 } |
| 583 | 584 |
| 584 @end // TranslateInfoBarControllerBase (TestingAPI) | 585 @end // TranslateInfoBarControllerBase (TestingAPI) |
| OLD | NEW |