| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 [[infobar_controller_ view] removeFromSuperview]; | 92 [[infobar_controller_ view] removeFromSuperview]; |
| 93 | 93 |
| 94 scoped_ptr<TranslateInfoBarDelegate> delegate( | 94 scoped_ptr<TranslateInfoBarDelegate> delegate( |
| 95 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error, | 95 new MockTranslateInfoBarDelegate(web_contents_.get(), type, error, |
| 96 profile->GetPrefs())); | 96 profile->GetPrefs())); |
| 97 scoped_ptr<InfoBar> infobar( | 97 scoped_ptr<InfoBar> infobar( |
| 98 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass())); | 98 TranslateInfoBarDelegate::CreateInfoBar(delegate.Pass())); |
| 99 if (infobar_) | 99 if (infobar_) |
| 100 infobar_->CloseSoon(); | 100 infobar_->CloseSoon(); |
| 101 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); | 101 infobar_ = static_cast<InfoBarCocoa*>(infobar.release()); |
| 102 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get())); | 102 infobar_->SetOwner(InfoBarService::FromWebContents(web_contents_.get()) |
| 103 ->infobar_manager()); |
| 103 | 104 |
| 104 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( | 105 infobar_controller_.reset([static_cast<TranslateInfoBarControllerBase*>( |
| 105 infobar_->controller()) retain]); | 106 infobar_->controller()) retain]); |
| 106 | 107 |
| 107 // We need to set the window to be wide so that the options button | 108 // We need to set the window to be wide so that the options button |
| 108 // doesn't overlap the other buttons. | 109 // doesn't overlap the other buttons. |
| 109 [test_window() setContentSize:NSMakeSize(2000, 500)]; | 110 [test_window() setContentSize:NSMakeSize(2000, 500)]; |
| 110 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; | 111 [[infobar_controller_ view] setFrame:NSMakeRect(0, 0, 2000, 500)]; |
| 111 [[test_window() contentView] addSubview:[infobar_controller_ view]]; | 112 [[test_window() contentView] addSubview:[infobar_controller_ view]]; |
| 112 } | 113 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 translate_prefs->ResetTranslationDeniedCount("en"); | 257 translate_prefs->ResetTranslationDeniedCount("en"); |
| 257 for (int i = 0; i < 4; ++i) { | 258 for (int i = 0; i < 4; ++i) { |
| 258 translate_prefs->IncrementTranslationDeniedCount("en"); | 259 translate_prefs->IncrementTranslationDeniedCount("en"); |
| 259 } | 260 } |
| 260 CreateInfoBar(TranslateTabHelper::BEFORE_TRANSLATE); | 261 CreateInfoBar(TranslateTabHelper::BEFORE_TRANSLATE); |
| 261 BeforeTranslateInfobarController* controller = | 262 BeforeTranslateInfobarController* controller = |
| 262 (BeforeTranslateInfobarController*)infobar_controller_.get(); | 263 (BeforeTranslateInfobarController*)infobar_controller_.get(); |
| 263 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); | 264 EXPECT_TRUE([[controller alwaysTranslateButton] superview] == nil); |
| 264 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); | 265 EXPECT_TRUE([[controller neverTranslateButton] superview] != nil); |
| 265 } | 266 } |
| OLD | NEW |