| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
| 17 #include "chrome/common/translate/translate_errors.h" | 18 #include "chrome/common/translate/translate_errors.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 20 | 21 |
| 21 template <typename T> struct DefaultSingletonTraits; | 22 template <typename T> struct DefaultSingletonTraits; |
| 22 class GURL; | 23 class GURL; |
| 23 struct LanguageDetectionDetails; | 24 struct LanguageDetectionDetails; |
| 24 struct PageTranslatedDetails; | 25 struct PageTranslatedDetails; |
| 25 class PrefService; | 26 class PrefService; |
| 26 class Profile; | 27 class Profile; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 PageTranslatedDetails* details); | 185 PageTranslatedDetails* details); |
| 185 | 186 |
| 186 void OnTranslateScriptFetchComplete(bool success, const std::string& data); | 187 void OnTranslateScriptFetchComplete(bool success, const std::string& data); |
| 187 | 188 |
| 188 // Notifies to the observers when a language is detected. | 189 // Notifies to the observers when a language is detected. |
| 189 void NotifyLanguageDetection(const LanguageDetectionDetails& details); | 190 void NotifyLanguageDetection(const LanguageDetectionDetails& details); |
| 190 | 191 |
| 191 // Notifies to the observers when translate failed. | 192 // Notifies to the observers when translate failed. |
| 192 void NotifyTranslateError(const TranslateErrorDetails& details); | 193 void NotifyTranslateError(const TranslateErrorDetails& details); |
| 193 | 194 |
| 195 // Shows the translate bubble. |
| 196 void ShowBubble(content::WebContents* web_contents, |
| 197 TranslateBubbleModel::ViewState view_state); |
| 198 |
| 194 // Returns the different parameters used to decide whether extra shortcuts | 199 // Returns the different parameters used to decide whether extra shortcuts |
| 195 // are needed. | 200 // are needed. |
| 196 static ShortcutConfiguration ShortcutConfig(); | 201 static ShortcutConfiguration ShortcutConfig(); |
| 197 | 202 |
| 198 content::NotificationRegistrar notification_registrar_; | 203 content::NotificationRegistrar notification_registrar_; |
| 199 | 204 |
| 200 // Max number of attempts before checking if a page has been reloaded. | 205 // Max number of attempts before checking if a page has been reloaded. |
| 201 int max_reload_check_attempts_; | 206 int max_reload_check_attempts_; |
| 202 | 207 |
| 203 // The list of pending translate requests. Translate requests are queued when | 208 // The list of pending translate requests. Translate requests are queued when |
| (...skipping 14 matching lines...) Expand all Loading... |
| 218 // An instance of TranslateAcceptLanguages which manages Accept languages of | 223 // An instance of TranslateAcceptLanguages which manages Accept languages of |
| 219 // each profiles. | 224 // each profiles. |
| 220 scoped_ptr<TranslateAcceptLanguages> accept_languages_; | 225 scoped_ptr<TranslateAcceptLanguages> accept_languages_; |
| 221 | 226 |
| 222 base::WeakPtrFactory<TranslateManager> weak_method_factory_; | 227 base::WeakPtrFactory<TranslateManager> weak_method_factory_; |
| 223 | 228 |
| 224 DISALLOW_COPY_AND_ASSIGN(TranslateManager); | 229 DISALLOW_COPY_AND_ASSIGN(TranslateManager); |
| 225 }; | 230 }; |
| 226 | 231 |
| 227 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ | 232 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ |
| OLD | NEW |