| 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_DOWNLOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Returns true if |language| is supported by the translation server as an | 71 // Returns true if |language| is supported by the translation server as an |
| 72 // alpha language. | 72 // alpha language. |
| 73 static bool IsAlphaLanguage(const std::string& language); | 73 static bool IsAlphaLanguage(const std::string& language); |
| 74 | 74 |
| 75 // Must be called to shut Translate down. Cancels any pending fetches. | 75 // Must be called to shut Translate down. Cancels any pending fetches. |
| 76 void Shutdown(); | 76 void Shutdown(); |
| 77 | 77 |
| 78 // Clears the translate script, so it will be fetched next time we translate. | 78 // Clears the translate script, so it will be fetched next time we translate. |
| 79 void ClearTranslateScriptForTesting(); | 79 void ClearTranslateScriptForTesting(); |
| 80 | 80 |
| 81 // Resets to its initial state as if newly created. |
| 82 void ResetForTesting(); |
| 83 |
| 81 // Used by unit-tests to override some defaults: | 84 // Used by unit-tests to override some defaults: |
| 82 // Delay after which the translate script is fetched again from the | 85 // Delay after which the translate script is fetched again from the |
| 83 // translation server. | 86 // translation server. |
| 84 void SetTranslateScriptExpirationDelay(int delay_ms); | 87 void SetTranslateScriptExpirationDelay(int delay_ms); |
| 85 | 88 |
| 86 private: | 89 private: |
| 87 friend struct DefaultSingletonTraits<TranslateDownloadManager>; | 90 friend struct DefaultSingletonTraits<TranslateDownloadManager>; |
| 88 TranslateDownloadManager(); | 91 TranslateDownloadManager(); |
| 89 virtual ~TranslateDownloadManager(); | 92 virtual ~TranslateDownloadManager(); |
| 90 | 93 |
| 91 scoped_ptr<TranslateLanguageList> language_list_; | 94 scoped_ptr<TranslateLanguageList> language_list_; |
| 92 | 95 |
| 93 // An instance of TranslateScript which manages JavaScript source for | 96 // An instance of TranslateScript which manages JavaScript source for |
| 94 // Translate. | 97 // Translate. |
| 95 scoped_ptr<TranslateScript> script_; | 98 scoped_ptr<TranslateScript> script_; |
| 96 | 99 |
| 97 std::string application_locale_; | 100 std::string application_locale_; |
| 98 scoped_refptr<net::URLRequestContextGetter> request_context_; | 101 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 104 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |