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 "ios/chrome/browser/translate/chrome_ios_translate_client.h" | 5 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "components/infobars/core/infobar.h" | 12 #include "components/infobars/core/infobar.h" |
13 #include "components/metrics/proto/translate_event.pb.h" | |
13 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
14 #include "components/translate/core/browser/page_translated_details.h" | 15 #include "components/translate/core/browser/page_translated_details.h" |
15 #include "components/translate/core/browser/translate_accept_languages.h" | 16 #include "components/translate/core/browser/translate_accept_languages.h" |
16 #include "components/translate/core/browser/translate_infobar_delegate.h" | 17 #include "components/translate/core/browser/translate_infobar_delegate.h" |
17 #include "components/translate/core/browser/translate_manager.h" | 18 #include "components/translate/core/browser/translate_manager.h" |
18 #include "components/translate/core/browser/translate_prefs.h" | 19 #include "components/translate/core/browser/translate_prefs.h" |
19 #include "components/translate/core/browser/translate_step.h" | 20 #include "components/translate/core/browser/translate_step.h" |
20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 21 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
21 #include "ios/chrome/browser/infobars/infobar.h" | 22 #include "ios/chrome/browser/infobars/infobar.h" |
22 #include "ios/chrome/browser/infobars/infobar_controller.h" | 23 #include "ios/chrome/browser/infobars/infobar_controller.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 initWithDelegate:infobar.get()]); | 94 initWithDelegate:infobar.get()]); |
94 break; | 95 break; |
95 default: | 96 default: |
96 NOTREACHED(); | 97 NOTREACHED(); |
97 } | 98 } |
98 infobar->SetController(controller); | 99 infobar->SetController(controller); |
99 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. | 100 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. |
100 return std::move(infobar); | 101 return std::move(infobar); |
101 } | 102 } |
102 | 103 |
104 void ChromeIOSTranslateClient::RecordTranslateEvent( | |
105 const metrics::TranslateEventProto&) { | |
106 // TODO(renjieliu): Implementing gaia-keyed logging. | |
Eugene But (OOO till 7-30)
2017/06/12 01:50:00
In ios we normally use |TODO(crbug.com/<bug number
renjieliu1
2017/06/13 00:04:59
got it, thanks!
| |
107 } | |
108 | |
103 void ChromeIOSTranslateClient::ShowTranslateUI( | 109 void ChromeIOSTranslateClient::ShowTranslateUI( |
104 translate::TranslateStep step, | 110 translate::TranslateStep step, |
105 const std::string& source_language, | 111 const std::string& source_language, |
106 const std::string& target_language, | 112 const std::string& target_language, |
107 translate::TranslateErrors::Type error_type, | 113 translate::TranslateErrors::Type error_type, |
108 bool triggered_from_menu) { | 114 bool triggered_from_menu) { |
109 DCHECK(web_state()); | 115 DCHECK(web_state()); |
110 if (error_type != translate::TranslateErrors::NONE) | 116 if (error_type != translate::TranslateErrors::NONE) |
111 step = translate::TRANSLATE_STEP_TRANSLATE_ERROR; | 117 step = translate::TRANSLATE_STEP_TRANSLATE_ERROR; |
112 | 118 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 const GURL& report_url) { | 164 const GURL& report_url) { |
159 NOTREACHED(); | 165 NOTREACHED(); |
160 } | 166 } |
161 | 167 |
162 void ChromeIOSTranslateClient::WebStateDestroyed() { | 168 void ChromeIOSTranslateClient::WebStateDestroyed() { |
163 // Translation process can be interrupted. | 169 // Translation process can be interrupted. |
164 // Destroying the TranslateManager now guarantees that it never has to deal | 170 // Destroying the TranslateManager now guarantees that it never has to deal |
165 // with nullptr WebState. | 171 // with nullptr WebState. |
166 translate_manager_.reset(); | 172 translate_manager_.reset(); |
167 } | 173 } |
OLD | NEW |