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/core/browser/translate_ui_delegate.h" | 5 #include "components/translate/core/browser/translate_ui_delegate.h" |
6 | 6 |
7 #include "base/i18n/string_compare.h" | 7 #include "base/i18n/string_compare.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "components/translate/core/browser/language_state.h" | 9 #include "components/translate/core/browser/language_state.h" |
10 #include "components/translate/core/browser/translate_client.h" | 10 #include "components/translate/core/browser/translate_client.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const char kNeverTranslateLang[] = "Translate.NeverTranslateLang"; | 24 const char kNeverTranslateLang[] = "Translate.NeverTranslateLang"; |
25 const char kNeverTranslateSite[] = "Translate.NeverTranslateSite"; | 25 const char kNeverTranslateSite[] = "Translate.NeverTranslateSite"; |
26 const char kAlwaysTranslateLang[] = "Translate.AlwaysTranslateLang"; | 26 const char kAlwaysTranslateLang[] = "Translate.AlwaysTranslateLang"; |
27 const char kModifyOriginalLang[] = "Translate.ModifyOriginalLang"; | 27 const char kModifyOriginalLang[] = "Translate.ModifyOriginalLang"; |
28 const char kModifyTargetLang[] = "Translate.ModifyTargetLang"; | 28 const char kModifyTargetLang[] = "Translate.ModifyTargetLang"; |
29 const char kDeclineTranslateDismissUI[] = "Translate.DeclineTranslateDismissUI"; | 29 const char kDeclineTranslateDismissUI[] = "Translate.DeclineTranslateDismissUI"; |
30 const char kShowErrorUI[] = "Translate.ShowErrorUI"; | 30 const char kShowErrorUI[] = "Translate.ShowErrorUI"; |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
| 34 namespace translate { |
| 35 |
34 TranslateUIDelegate::TranslateUIDelegate( | 36 TranslateUIDelegate::TranslateUIDelegate( |
35 const base::WeakPtr<TranslateManager>& translate_manager, | 37 const base::WeakPtr<TranslateManager>& translate_manager, |
36 const std::string& original_language, | 38 const std::string& original_language, |
37 const std::string& target_language) | 39 const std::string& target_language) |
38 : translate_driver_( | 40 : translate_driver_( |
39 translate_manager->translate_client()->GetTranslateDriver()), | 41 translate_manager->translate_client()->GetTranslateDriver()), |
40 translate_manager_(translate_manager), | 42 translate_manager_(translate_manager), |
41 original_language_index_(NO_INDEX), | 43 original_language_index_(NO_INDEX), |
42 initial_original_language_index_(NO_INDEX), | 44 initial_original_language_index_(NO_INDEX), |
43 target_language_index_(NO_INDEX) { | 45 target_language_index_(NO_INDEX) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 prefs_->RemoveLanguagePairFromWhitelist(original_lang, target_lang); | 252 prefs_->RemoveLanguagePairFromWhitelist(original_lang, target_lang); |
251 | 253 |
252 UMA_HISTOGRAM_BOOLEAN(kAlwaysTranslateLang, true); | 254 UMA_HISTOGRAM_BOOLEAN(kAlwaysTranslateLang, true); |
253 } | 255 } |
254 | 256 |
255 std::string TranslateUIDelegate::GetPageHost() { | 257 std::string TranslateUIDelegate::GetPageHost() { |
256 if (!translate_driver_->HasCurrentPage()) | 258 if (!translate_driver_->HasCurrentPage()) |
257 return std::string(); | 259 return std::string(); |
258 return translate_driver_->GetActiveURL().HostNoBrackets(); | 260 return translate_driver_->GetActiveURL().HostNoBrackets(); |
259 } | 261 } |
| 262 |
| 263 } // namespace translate |
OLD | NEW |