| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/logging.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 13 |
| 14 template <typename T> struct DefaultSingletonTraits; |
| 15 |
| 16 // Manages the downloaded resources for Translate, such as the translate script |
| 17 // and the language list. |
| 18 // TODO(droger): TranslateDownloadManager should own TranslateLanguageList and |
| 19 // TranslateScript. See http://crbug.com/335074 and http://crbug.com/335077. |
| 20 class TranslateDownloadManager { |
| 21 public: |
| 22 // Returns the singleton instance. |
| 23 static TranslateDownloadManager* GetInstance(); |
| 24 |
| 25 // The request context used to download the resources. |
| 26 // Should be set before this class can be used. |
| 27 net::URLRequestContextGetter* request_context() { return request_context_; } |
| 28 void set_request_context(net::URLRequestContextGetter* context) { |
| 29 request_context_ = context; |
| 30 } |
| 31 |
| 32 // The application locale. |
| 33 // Should be set before this class can be used. |
| 34 const std::string& application_locale() { |
| 35 DCHECK(!application_locale_.empty()); |
| 36 return application_locale_; |
| 37 } |
| 38 void set_application_locale(const std::string& locale) { |
| 39 application_locale_ = locale; |
| 40 } |
| 41 |
| 42 private: |
| 43 friend struct DefaultSingletonTraits<TranslateDownloadManager>; |
| 44 TranslateDownloadManager(); |
| 45 virtual ~TranslateDownloadManager(); |
| 46 |
| 47 std::string application_locale_; |
| 48 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 49 }; |
| 50 |
| 51 #endif // COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |