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/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/translate/translate_infobar_delegate.h" | 10 #import "chrome/browser/translate/translate_tab_helper.h" |
11 #import "chrome/browser/ui/cocoa/hover_close_button.h" | 11 #import "chrome/browser/ui/cocoa/hover_close_button.h" |
12 #include "chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h" | 12 #include "chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h" |
13 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" | 13 #import "chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h" |
14 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" | 14 #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" |
15 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 15 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
16 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" | 16 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
17 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" | 17 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" |
18 #import "chrome/browser/ui/cocoa/infobars/infobar_utilities.h" | 18 #import "chrome/browser/ui/cocoa/infobars/infobar_utilities.h" |
19 #include "chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.
h" | 19 #include "chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.
h" |
| 20 #include "components/translate/core/browser/translate_infobar_delegate.h" |
20 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
21 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" | 22 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT
weaker.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 | 24 |
24 using InfoBarUtilities::MoveControl; | 25 using InfoBarUtilities::MoveControl; |
25 using InfoBarUtilities::VerticallyCenterView; | 26 using InfoBarUtilities::VerticallyCenterView; |
26 using InfoBarUtilities::VerifyControlOrderAndSpacing; | 27 using InfoBarUtilities::VerifyControlOrderAndSpacing; |
27 using InfoBarUtilities::CreateLabel; | 28 using InfoBarUtilities::CreateLabel; |
28 using InfoBarUtilities::AddMenuItem; | 29 using InfoBarUtilities::AddMenuItem; |
29 | 30 |
30 // static | 31 scoped_ptr<infobars::InfoBar> TranslateTabHelper::CreateInfoBar( |
31 scoped_ptr<infobars::InfoBar> TranslateInfoBarDelegate::CreateInfoBar( | 32 scoped_ptr<TranslateInfoBarDelegate> delegate) const { |
32 scoped_ptr<TranslateInfoBarDelegate> delegate) { | |
33 scoped_ptr<InfoBarCocoa> infobar( | 33 scoped_ptr<InfoBarCocoa> infobar( |
34 new InfoBarCocoa(delegate.PassAs<infobars::InfoBarDelegate>())); | 34 new InfoBarCocoa(delegate.PassAs<infobars::InfoBarDelegate>())); |
35 base::scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller; | 35 base::scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller; |
36 switch (infobar->delegate()->AsTranslateInfoBarDelegate()->translate_step()) { | 36 switch (infobar->delegate()->AsTranslateInfoBarDelegate()->translate_step()) { |
37 case translate::TRANSLATE_STEP_BEFORE_TRANSLATE: | 37 case translate::TRANSLATE_STEP_BEFORE_TRANSLATE: |
38 infobar_controller.reset([[BeforeTranslateInfobarController alloc] | 38 infobar_controller.reset([[BeforeTranslateInfobarController alloc] |
39 initWithInfoBar:infobar.get()]); | 39 initWithInfoBar:infobar.get()]); |
40 break; | 40 break; |
41 case translate::TRANSLATE_STEP_AFTER_TRANSLATE: | 41 case translate::TRANSLATE_STEP_AFTER_TRANSLATE: |
42 infobar_controller.reset([[AfterTranslateInfobarController alloc] | 42 infobar_controller.reset([[AfterTranslateInfobarController alloc] |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 [[control description] UTF8String] <<[title UTF8String]; | 546 [[control description] UTF8String] <<[title UTF8String]; |
547 return false; | 547 return false; |
548 } | 548 } |
549 previousControl = control; | 549 previousControl = control; |
550 } | 550 } |
551 | 551 |
552 return true; | 552 return true; |
553 } | 553 } |
554 | 554 |
555 @end // TranslateInfoBarControllerBase (TestingAPI) | 555 @end // TranslateInfoBarControllerBase (TestingAPI) |
OLD | NEW |