OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/web_view/internal/translate/criwv_translate_manager_impl.h" | 5 #import "ios/web_view/internal/translate/cwv_translate_manager_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "components/translate/core/browser/translate_manager.h" | 9 #include "components/translate/core/browser/translate_manager.h" |
10 #include "components/translate/core/browser/translate_ui_delegate.h" | 10 #include "components/translate/core/browser/translate_ui_delegate.h" |
11 | 11 |
12 @implementation CRIWVTranslateManagerImpl { | 12 @implementation CWVTranslateManagerImpl { |
13 std::unique_ptr<translate::TranslateUIDelegate> _translateUIDelegate; | 13 std::unique_ptr<translate::TranslateUIDelegate> _translateUIDelegate; |
14 } | 14 } |
15 | 15 |
16 - (instancetype)initWithTranslateManager:(translate::TranslateManager*)manager | 16 - (instancetype)initWithTranslateManager:(translate::TranslateManager*)manager |
17 sourceLanguage:(const std::string&)source | 17 sourceLanguage:(const std::string&)source |
18 targetLanguage:(const std::string&)target { | 18 targetLanguage:(const std::string&)target { |
19 if ((self = [super init])) { | 19 if ((self = [super init])) { |
20 DCHECK(manager); | 20 DCHECK(manager); |
21 _translateUIDelegate = base::MakeUnique<translate::TranslateUIDelegate>( | 21 _translateUIDelegate = base::MakeUnique<translate::TranslateUIDelegate>( |
22 manager->GetWeakPtr(), source, target); | 22 manager->GetWeakPtr(), source, target); |
23 } | 23 } |
24 return self; | 24 return self; |
25 } | 25 } |
26 | 26 |
27 #pragma mark CRIWVTranslateManager methods | 27 #pragma mark CRIWVTranslateManager methods |
28 | 28 |
29 - (void)translate { | 29 - (void)translate { |
30 _translateUIDelegate->Translate(); | 30 _translateUIDelegate->Translate(); |
31 } | 31 } |
32 | 32 |
33 - (void)revertTranslation { | 33 - (void)revertTranslation { |
34 _translateUIDelegate->RevertTranslation(); | 34 _translateUIDelegate->RevertTranslation(); |
35 } | 35 } |
36 | 36 |
37 @end | 37 @end |
OLD | NEW |