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

Side by Side Diff: ios/web_view/internal/translate/web_view_translate_client.mm

Issue 2913573002: Updates language model on iOS. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « ios/chrome/browser/translate/language_model_factory_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/web_view_translate_client.h" 5 #import "ios/web_view/internal/translate/web_view_translate_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 26 matching lines...) Expand all
37 WebViewTranslateClient::WebViewTranslateClient(web::WebState* web_state) 37 WebViewTranslateClient::WebViewTranslateClient(web::WebState* web_state)
38 : web::WebStateObserver(web_state), 38 : web::WebStateObserver(web_state),
39 translate_manager_(base::MakeUnique<translate::TranslateManager>( 39 translate_manager_(base::MakeUnique<translate::TranslateManager>(
40 this, 40 this,
41 WebViewTranslateRankerFactory::GetForBrowserState( 41 WebViewTranslateRankerFactory::GetForBrowserState(
42 WebViewBrowserState::FromBrowserState( 42 WebViewBrowserState::FromBrowserState(
43 web_state->GetBrowserState())), 43 web_state->GetBrowserState())),
44 prefs::kAcceptLanguages)), 44 prefs::kAcceptLanguages)),
45 translate_driver_(web_state, 45 translate_driver_(web_state,
46 web_state->GetNavigationManager(), 46 web_state->GetNavigationManager(),
47 translate_manager_.get()) {} 47 translate_manager_.get(),
48 nil) {}
jkrcal 2017/06/02 08:35:09 nit: /*language_model=*/nil Why don't you feed th
jkrcal 2017/06/02 08:36:39 Actually, I know nothing about code style for .mm
ramyasharma 2017/06/05 05:07:26 Thanks Jan. The only reason I pass nil, is because
48 49
49 WebViewTranslateClient::~WebViewTranslateClient() = default; 50 WebViewTranslateClient::~WebViewTranslateClient() = default;
50 51
51 // TranslateClient implementation: 52 // TranslateClient implementation:
52 53
53 std::unique_ptr<infobars::InfoBar> WebViewTranslateClient::CreateInfoBar( 54 std::unique_ptr<infobars::InfoBar> WebViewTranslateClient::CreateInfoBar(
54 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const { 55 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const {
55 NOTREACHED(); 56 NOTREACHED();
56 return nullptr; 57 return nullptr;
57 } 58 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 120
120 void WebViewTranslateClient::WebStateDestroyed() { 121 void WebViewTranslateClient::WebStateDestroyed() {
121 // Translation process can be interrupted. 122 // Translation process can be interrupted.
122 // Destroying the TranslateManager now guarantees that it never has to deal 123 // Destroying the TranslateManager now guarantees that it never has to deal
123 // with nullptr WebState. 124 // with nullptr WebState.
124 translate_manager_.reset(); 125 translate_manager_.reset();
125 } 126 }
126 127
127 } // namespace ios_web_view 128 } // namespace ios_web_view
OLDNEW
« no previous file with comments | « ios/chrome/browser/translate/language_model_factory_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698