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_client.h" | 5 #import "ios/web_view/internal/translate/criwv_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 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
11 #import "base/mac/scoped_nsobject.h" | |
12 #include "components/infobars/core/infobar.h" | 12 #include "components/infobars/core/infobar.h" |
13 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
14 #include "components/translate/core/browser/page_translated_details.h" | 14 #include "components/translate/core/browser/page_translated_details.h" |
15 #include "components/translate/core/browser/translate_accept_languages.h" | 15 #include "components/translate/core/browser/translate_accept_languages.h" |
16 #include "components/translate/core/browser/translate_infobar_delegate.h" | 16 #include "components/translate/core/browser/translate_infobar_delegate.h" |
17 #include "components/translate/core/browser/translate_manager.h" | 17 #include "components/translate/core/browser/translate_manager.h" |
18 #include "components/translate/core/browser/translate_prefs.h" | 18 #include "components/translate/core/browser/translate_prefs.h" |
19 #include "components/translate/core/browser/translate_step.h" | 19 #include "components/translate/core/browser/translate_step.h" |
20 #include "ios/web/public/browser_state.h" | 20 #include "ios/web/public/browser_state.h" |
21 #import "ios/web/public/web_state/web_state.h" | 21 #import "ios/web/public/web_state/web_state.h" |
22 #include "ios/web_view/internal/criwv_browser_state.h" | 22 #include "ios/web_view/internal/criwv_browser_state.h" |
23 #include "ios/web_view/internal/pref_names.h" | 23 #include "ios/web_view/internal/pref_names.h" |
24 #include "ios/web_view/internal/translate/criwv_translate_accept_languages_facto
ry.h" | 24 #include "ios/web_view/internal/translate/criwv_translate_accept_languages_facto
ry.h" |
25 #import "ios/web_view/internal/translate/criwv_translate_manager_impl.h" | 25 #import "ios/web_view/internal/translate/criwv_translate_manager_impl.h" |
26 #import "ios/web_view/public/criwv_translate_delegate.h" | 26 #import "ios/web_view/public/cwv_translate_delegate.h" |
27 #include "url/gurl.h" | 27 #include "url/gurl.h" |
28 | 28 |
29 DEFINE_WEB_STATE_USER_DATA_KEY(ios_web_view::CRIWVTranslateClient); | 29 DEFINE_WEB_STATE_USER_DATA_KEY(ios_web_view::CRIWVTranslateClient); |
30 | 30 |
31 namespace ios_web_view { | 31 namespace ios_web_view { |
32 | 32 |
33 CRIWVTranslateClient::CRIWVTranslateClient(web::WebState* web_state) | 33 CRIWVTranslateClient::CRIWVTranslateClient(web::WebState* web_state) |
34 : web::WebStateObserver(web_state), | 34 : web::WebStateObserver(web_state), |
35 translate_manager_(base::MakeUnique<translate::TranslateManager>( | 35 translate_manager_(base::MakeUnique<translate::TranslateManager>( |
36 this, | 36 this, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 void CRIWVTranslateClient::WebStateDestroyed() { | 139 void CRIWVTranslateClient::WebStateDestroyed() { |
140 // Translation process can be interrupted. | 140 // Translation process can be interrupted. |
141 // Destroying the TranslateManager now guarantees that it never has to deal | 141 // Destroying the TranslateManager now guarantees that it never has to deal |
142 // with nullptr WebState. | 142 // with nullptr WebState. |
143 translate_manager_.reset(); | 143 translate_manager_.reset(); |
144 } | 144 } |
145 | 145 |
146 } // namespace ios_web_view | 146 } // namespace ios_web_view |
OLD | NEW |