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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 117 |
118 // Record an event of the given |event_type| using the currently saved | 118 // Record an event of the given |event_type| using the currently saved |
119 // |translate_event_| as context. |event_type| must be one of the values | 119 // |translate_event_| as context. |event_type| must be one of the values |
120 // defined by metrics::TranslateEventProto::EventType. | 120 // defined by metrics::TranslateEventProto::EventType. |
121 void RecordTranslateEvent(int event_type); | 121 void RecordTranslateEvent(int event_type); |
122 | 122 |
123 // By default, don't offer to translate in builds lacking an API key. For | 123 // By default, don't offer to translate in builds lacking an API key. For |
124 // testing, set to true to offer anyway. | 124 // testing, set to true to offer anyway. |
125 static void SetIgnoreMissingKeyForTesting(bool ignore); | 125 static void SetIgnoreMissingKeyForTesting(bool ignore); |
126 | 126 |
127 // Returns true if the decision should be overridden and logs the event | |
128 // appropriately. |event_type| must be one of the | |
129 // values defined by metrics::TranslateEventProto::EventType. | |
130 bool ShouldOverrideDecision(int event_type); | |
131 | |
132 // Returns true if the BubbleUI should be suppressed. | |
133 bool ShouldSuppressBubbleUI(bool triggered_from_menu, | |
134 const std::string& source_language); | |
Roger McFarlane (Chromium)
2017/04/19 16:16:16
why is this bubble ui specific?
hamelphi
2017/04/19 18:19:48
I don't know the reasons why this logic is only ap
| |
135 | |
127 private: | 136 private: |
128 friend class translate::testing::TranslateManagerTest; | 137 friend class translate::testing::TranslateManagerTest; |
129 | 138 |
130 // Sends a translation request to the TranslateDriver. | 139 // Sends a translation request to the TranslateDriver. |
131 void DoTranslatePage(const std::string& translate_script, | 140 void DoTranslatePage(const std::string& translate_script, |
132 const std::string& source_lang, | 141 const std::string& source_lang, |
133 const std::string& target_lang); | 142 const std::string& target_lang); |
134 | 143 |
135 // Returns the language to translate to by looking at ULP. Return empty string | 144 // Returns the language to translate to by looking at ULP. Return empty string |
136 // If it cannot conclude from ULP. | 145 // If it cannot conclude from ULP. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // By default, don't offer to translate in builds lacking an API key. For | 183 // By default, don't offer to translate in builds lacking an API key. For |
175 // testing, set to true to offer anyway. | 184 // testing, set to true to offer anyway. |
176 static bool ignore_missing_key_for_testing_; | 185 static bool ignore_missing_key_for_testing_; |
177 | 186 |
178 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 187 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
179 }; | 188 }; |
180 | 189 |
181 } // namespace translate | 190 } // namespace translate |
182 | 191 |
183 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ | 192 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_MANAGER_H_ |
OLD | NEW |