Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" | 5 #include "ios/public/provider/chrome/browser/test_chrome_browser_provider.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service .h" | 12 #include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service .h" |
| 13 #import "ios/public/provider/chrome/browser/test_updatable_resource_provider.h" | 13 #import "ios/public/provider/chrome/browser/test_updatable_resource_provider.h" |
| 14 #import "ios/public/provider/chrome/browser/voice/test_voice_search_provider.h" | |
| 14 #import "ios/public/provider/chrome/browser/voice/voice_search_language.h" | 15 #import "ios/public/provider/chrome/browser/voice/voice_search_language.h" |
| 15 | 16 |
| 16 @interface TestStyledTextField : UITextField<TextFieldStyling> | 17 @interface TestStyledTextField : UITextField<TextFieldStyling> |
| 17 @end | 18 @end |
| 18 | 19 |
| 19 @implementation TestStyledTextField | 20 @implementation TestStyledTextField |
| 20 @synthesize placeholderStyle = _placeholderStyle; | 21 @synthesize placeholderStyle = _placeholderStyle; |
| 21 @synthesize textValidator = _textValidator; | 22 @synthesize textValidator = _textValidator; |
| 22 | 23 |
| 23 - (void)setUseErrorStyling:(BOOL)error { | 24 - (void)setUseErrorStyling:(BOOL)error { |
| 24 } | 25 } |
| 25 @end | 26 @end |
| 26 | 27 |
| 27 namespace ios { | 28 namespace ios { |
| 28 | 29 |
| 29 TestChromeBrowserProvider::TestChromeBrowserProvider() | 30 TestChromeBrowserProvider::TestChromeBrowserProvider() |
| 30 : test_updatable_resource_provider_(new TestUpdatableResourceProvider) {} | 31 : test_updatable_resource_provider_(new TestUpdatableResourceProvider), |
|
sdefresne
2016/10/18 22:19:44
nit: can you change this to use base::MakeUnique<>
rohitrao (ping after 24h)
2016/10/18 23:30:44
Done.
| |
| 32 test_voice_search_provider_(base::MakeUnique<TestVoiceSearchProvider>()) { | |
| 33 } | |
| 31 | 34 |
| 32 TestChromeBrowserProvider::~TestChromeBrowserProvider() {} | 35 TestChromeBrowserProvider::~TestChromeBrowserProvider() {} |
| 33 | 36 |
| 34 // static | 37 // static |
| 35 TestChromeBrowserProvider* TestChromeBrowserProvider::GetTestProvider() { | 38 TestChromeBrowserProvider* TestChromeBrowserProvider::GetTestProvider() { |
| 36 ChromeBrowserProvider* provider = GetChromeBrowserProvider(); | 39 ChromeBrowserProvider* provider = GetChromeBrowserProvider(); |
| 37 DCHECK(provider); | 40 DCHECK(provider); |
| 38 return static_cast<TestChromeBrowserProvider*>(provider); | 41 return static_cast<TestChromeBrowserProvider*>(provider); |
| 39 } | 42 } |
| 40 | 43 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 54 TestChromeBrowserProvider::GetUpdatableResourceProvider() { | 57 TestChromeBrowserProvider::GetUpdatableResourceProvider() { |
| 55 return test_updatable_resource_provider_.get(); | 58 return test_updatable_resource_provider_.get(); |
| 56 } | 59 } |
| 57 | 60 |
| 58 UITextField<TextFieldStyling>* TestChromeBrowserProvider::CreateStyledTextField( | 61 UITextField<TextFieldStyling>* TestChromeBrowserProvider::CreateStyledTextField( |
| 59 CGRect frame) const { | 62 CGRect frame) const { |
| 60 return [[TestStyledTextField alloc] initWithFrame:frame]; | 63 return [[TestStyledTextField alloc] initWithFrame:frame]; |
| 61 } | 64 } |
| 62 | 65 |
| 63 NSArray* TestChromeBrowserProvider::GetAvailableVoiceSearchLanguages() const { | 66 NSArray* TestChromeBrowserProvider::GetAvailableVoiceSearchLanguages() const { |
| 64 base::scoped_nsobject<VoiceSearchLanguage> en([[VoiceSearchLanguage alloc] | 67 base::scoped_nsobject<VoiceSearchLanguage> en([[VoiceSearchLanguage alloc] |
|
sdefresne
2016/10/18 22:19:44
nit: can you change to the following:
return vo
rohitrao (ping after 24h)
2016/10/18 23:30:44
Done.
| |
| 65 initWithIdentifier:@"en-US" | 68 initWithIdentifier:@"en-US" |
| 66 displayName:@"English (US)" | 69 displayName:@"English (US)" |
| 67 localizationPreference:nil]); | 70 localizationPreference:nil]); |
| 68 return @[ en ]; | 71 return @[ en ]; |
| 69 } | 72 } |
| 70 | 73 |
| 74 VoiceSearchProvider* TestChromeBrowserProvider::GetVoiceSearchProvider() { | |
| 75 return test_voice_search_provider_.get(); | |
| 76 } | |
| 77 | |
| 71 } // namespace ios | 78 } // namespace ios |
| OLD | NEW |