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 #include "components/translate/ios/browser/language_detection_controller.h" | 5 #include "components/translate/ios/browser/language_detection_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "components/prefs/pref_member.h" | 13 #include "components/prefs/pref_member.h" |
14 #include "components/translate/core/browser/translate_pref_names.h" | 14 #include "components/translate/core/browser/translate_pref_names.h" |
15 #include "components/translate/core/language_detection/language_detection_util.h
" | 15 #include "components/translate/core/language_detection/language_detection_util.h
" |
16 #import "components/translate/ios/browser/js_language_detection_manager.h" | 16 #import "components/translate/ios/browser/js_language_detection_manager.h" |
17 #include "components/translate/ios/browser/string_clipping_util.h" | 17 #include "components/translate/ios/browser/string_clipping_util.h" |
18 #import "ios/web/public/url_scheme_util.h" | 18 #import "ios/web/public/url_scheme_util.h" |
19 #include "ios/web/public/web_state/navigation_context.h" | 19 #import "ios/web/public/web_state/navigation_context.h" |
20 #include "ios/web/public/web_state/web_state.h" | 20 #include "ios/web/public/web_state/web_state.h" |
21 | 21 |
22 #if !defined(__has_feature) || !__has_feature(objc_arc) | 22 #if !defined(__has_feature) || !__has_feature(objc_arc) |
23 #error "This file requires ARC support." | 23 #error "This file requires ARC support." |
24 #endif | 24 #endif |
25 | 25 |
26 namespace translate { | 26 namespace translate { |
27 | 27 |
28 namespace { | 28 namespace { |
29 // Name for the UMA metric used to track text extraction time. | 29 // Name for the UMA metric used to track text extraction time. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 web::NavigationContext* navigation_context) { | 142 web::NavigationContext* navigation_context) { |
143 if (navigation_context->IsSameDocument()) | 143 if (navigation_context->IsSameDocument()) |
144 StartLanguageDetection(); | 144 StartLanguageDetection(); |
145 } | 145 } |
146 | 146 |
147 void LanguageDetectionController::WebStateDestroyed() { | 147 void LanguageDetectionController::WebStateDestroyed() { |
148 web_state()->RemoveScriptCommandCallback(kCommandPrefix); | 148 web_state()->RemoveScriptCommandCallback(kCommandPrefix); |
149 } | 149 } |
150 | 150 |
151 } // namespace translate | 151 } // namespace translate |
OLD | NEW |