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

Side by Side Diff: chrome/browser/ui/cocoa/infobars/translate_infobar_base.mm

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/translate/translate_infobar_delegate.h"
(...skipping 10 matching lines...) Expand all
21 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT weaker.h" 21 #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutT weaker.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 23
24 using InfoBarUtilities::MoveControl; 24 using InfoBarUtilities::MoveControl;
25 using InfoBarUtilities::VerticallyCenterView; 25 using InfoBarUtilities::VerticallyCenterView;
26 using InfoBarUtilities::VerifyControlOrderAndSpacing; 26 using InfoBarUtilities::VerifyControlOrderAndSpacing;
27 using InfoBarUtilities::CreateLabel; 27 using InfoBarUtilities::CreateLabel;
28 using InfoBarUtilities::AddMenuItem; 28 using InfoBarUtilities::AddMenuItem;
29 29
30 // static 30 // static
31 scoped_ptr<InfoBar> TranslateInfoBarDelegate::CreateInfoBar( 31 scoped_ptr<infobars::InfoBar> TranslateInfoBarDelegate::CreateInfoBar(
32 scoped_ptr<TranslateInfoBarDelegate> delegate) { 32 scoped_ptr<TranslateInfoBarDelegate> delegate) {
33 scoped_ptr<InfoBarCocoa> infobar( 33 scoped_ptr<InfoBarCocoa> infobar(
34 new InfoBarCocoa(delegate.PassAs<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]
43 initWithInfoBar:infobar.get()]); 43 initWithInfoBar:infobar.get()]);
44 break; 44 break;
45 case translate::TRANSLATE_STEP_TRANSLATING: 45 case translate::TRANSLATE_STEP_TRANSLATING:
46 case translate::TRANSLATE_STEP_TRANSLATE_ERROR: 46 case translate::TRANSLATE_STEP_TRANSLATE_ERROR:
47 infobar_controller.reset([[TranslateMessageInfobarController alloc] 47 infobar_controller.reset([[TranslateMessageInfobarController alloc]
48 initWithInfoBar:infobar.get()]); 48 initWithInfoBar:infobar.get()]);
49 break; 49 break;
50 default: 50 default:
51 NOTREACHED(); 51 NOTREACHED();
52 } 52 }
53 infobar->set_controller(infobar_controller); 53 infobar->set_controller(infobar_controller);
54 return infobar.PassAs<InfoBar>(); 54 return infobar.PassAs<infobars::InfoBar>();
55 } 55 }
56 56
57 @implementation TranslateInfoBarControllerBase (FrameChangeObserver) 57 @implementation TranslateInfoBarControllerBase (FrameChangeObserver)
58 58
59 // Triggered when the frame changes. This will figure out what size and 59 // Triggered when the frame changes. This will figure out what size and
60 // visibility the options popup should be. 60 // visibility the options popup should be.
61 - (void)didChangeFrame:(NSNotification*)notification { 61 - (void)didChangeFrame:(NSNotification*)notification {
62 [self adjustOptionsButtonSizeAndVisibilityForView: 62 [self adjustOptionsButtonSizeAndVisibilityForView:
63 [[self visibleControls] lastObject]]; 63 [[self visibleControls] lastObject]];
64 } 64 }
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_utilities.mm ('k') | chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698