OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
8 #import "base/strings/string_util.h" | 8 #import "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #import "chrome/app/chrome_command_ids.h" // For translate menu command ids. | 10 #import "chrome/app/chrome_command_ids.h" // For translate menu command ids. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 [[infobar_controller_ view] removeFromSuperview]; | 96 [[infobar_controller_ view] removeFromSuperview]; |
97 | 97 |
98 scoped_ptr<TranslateInfoBarDelegate> delegate( | 98 scoped_ptr<TranslateInfoBarDelegate> delegate( |
99 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error, | 99 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error, |
100 profile->GetPrefs())); | 100 profile->GetPrefs())); |
101 scoped_ptr<InfoBar> infobar( | 101 scoped_ptr<InfoBar> infobar( |
102 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass())); | 102 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass())); |
103 if (infobar_) | 103 if (infobar_) |
104 infobar_->CloseSoon(); | 104 infobar_->CloseSoon(); |
105 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); | 105 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); |
106 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get()) | 106 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get())); |
107 ->infobar_manager()); | |
108 | 107 |
109 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( | 108 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( |
110 infobar_->controller()) retain]); | 109 infobar_->controller()) retain]); |
111 | 110 |
112 // We need to set the window to be wide so that the options button | 111 // We need to set the window to be wide so that the options button |
113 // doesn't overlap the other buttons. | 112 // doesn't overlap the other buttons. |
114 [test_window() setContentSize:NSMakeSize(2000, 500)]; | 113 [test_window() setContentSize:NSMakeSize(2000, 500)]; |
115 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; | 114 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; |
116 [[test_window() contentView] addSubview:[infobar_controller_ view]]; | 115 [[test_window() contentView] addSubview:[infobar_controller_ view]]; |
117 } | 116 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 translate_prefs->ResetTranslationDeniedCount("en"); | 260 translate_prefs->ResetTranslationDeniedCount("en"); |
262 for (int i = 0; i < 4; ++i) { | 261 for (int i = 0; i < 4; ++i) { |
263 translate_prefs->IncrementTranslationDeniedCount("en"); | 262 translate_prefs->IncrementTranslationDeniedCount("en"); |
264 } | 263 } |
265 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE); | 264 CreateInfoBar(translate::TRANSLATE_STEP_BEFORE_TRANSLATE); |
266 BeforeTranslateInfobarController* controller = | 265 BeforeTranslateInfobarController* controller = |
267 (BeforeTranslateInfobarController*)infobar_controller_.get(); | 266 (BeforeTranslateInfobarController*)infobar_controller_.get(); |
268 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); | 267 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); |
269 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); | 268 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); |
270 } | 269 } |
OLD | NEW |