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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "components/translate/core/browser/translate_language_list.h" | 12 #include "components/translate/core/browser/translate_language_list.h" |
13 #include "components/translate/core/browser/translate_script.h" | 13 #include "components/translate/core/browser/translate_script.h" |
14 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
15 | 15 |
| 16 namespace base { |
16 template <typename T> struct DefaultSingletonTraits; | 17 template <typename T> struct DefaultSingletonTraits; |
| 18 } |
17 | 19 |
18 class PrefService; | 20 class PrefService; |
19 | 21 |
20 namespace translate { | 22 namespace translate { |
21 | 23 |
22 // Manages the downloaded resources for Translate, such as the translate script | 24 // Manages the downloaded resources for Translate, such as the translate script |
23 // and the language list. | 25 // and the language list. |
24 class TranslateDownloadManager { | 26 class TranslateDownloadManager { |
25 public: | 27 public: |
26 // Returns the singleton instance. | 28 // Returns the singleton instance. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 86 |
85 // Resets to its initial state as if newly created. | 87 // Resets to its initial state as if newly created. |
86 void ResetForTesting(); | 88 void ResetForTesting(); |
87 | 89 |
88 // Used by unit-tests to override some defaults: | 90 // Used by unit-tests to override some defaults: |
89 // Delay after which the translate script is fetched again from the | 91 // Delay after which the translate script is fetched again from the |
90 // translation server. | 92 // translation server. |
91 void SetTranslateScriptExpirationDelay(int delay_ms); | 93 void SetTranslateScriptExpirationDelay(int delay_ms); |
92 | 94 |
93 private: | 95 private: |
94 friend struct DefaultSingletonTraits<TranslateDownloadManager>; | 96 friend struct base::DefaultSingletonTraits<TranslateDownloadManager>; |
95 TranslateDownloadManager(); | 97 TranslateDownloadManager(); |
96 virtual ~TranslateDownloadManager(); | 98 virtual ~TranslateDownloadManager(); |
97 | 99 |
98 scoped_ptr<TranslateLanguageList> language_list_; | 100 scoped_ptr<TranslateLanguageList> language_list_; |
99 | 101 |
100 // An instance of TranslateScript which manages JavaScript source for | 102 // An instance of TranslateScript which manages JavaScript source for |
101 // Translate. | 103 // Translate. |
102 scoped_ptr<TranslateScript> script_; | 104 scoped_ptr<TranslateScript> script_; |
103 | 105 |
104 std::string application_locale_; | 106 std::string application_locale_; |
105 scoped_refptr<net::URLRequestContextGetter> request_context_; | 107 scoped_refptr<net::URLRequestContextGetter> request_context_; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace translate | 110 } // namespace translate |
109 | 111 |
110 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ | 112 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
OLD | NEW |