Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: components/translate/core/browser/translate_download_manager.h

Issue 159883002: Move TranslatePrefs to the Translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@acceptLanguages
Patch Set: Fix ChromeOS browsertests Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h"
11 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "components/translate/core/browser/translate_language_list.h" 12 #include "components/translate/core/browser/translate_language_list.h"
14 #include "components/translate/core/browser/translate_script.h" 13 #include "components/translate/core/browser/translate_script.h"
15 #include "net/url_request/url_request_context_getter.h" 14 #include "net/url_request/url_request_context_getter.h"
16 15
17 template <typename T> struct DefaultSingletonTraits; 16 template <typename T> struct DefaultSingletonTraits;
18 17
19 class PrefService; 18 class PrefService;
20 19
21 // Manages the downloaded resources for Translate, such as the translate script 20 // Manages the downloaded resources for Translate, such as the translate script
22 // and the language list. 21 // and the language list.
23 class TranslateDownloadManager { 22 class TranslateDownloadManager {
24 public: 23 public:
25 // Returns the singleton instance. 24 // Returns the singleton instance.
26 static TranslateDownloadManager* GetInstance(); 25 static TranslateDownloadManager* GetInstance();
27 26
28 // The request context used to download the resources. 27 // The request context used to download the resources.
29 // Should be set before this class can be used. 28 // Should be set before this class can be used.
30 net::URLRequestContextGetter* request_context() { return request_context_; } 29 net::URLRequestContextGetter* request_context() { return request_context_; }
31 void set_request_context(net::URLRequestContextGetter* context) { 30 void set_request_context(net::URLRequestContextGetter* context) {
32 request_context_ = context; 31 request_context_ = context;
33 } 32 }
34 33
35 // The application locale. 34 // The application locale.
36 // Should be set before this class can be used. 35 // Should be set before this class can be used.
37 const std::string& application_locale() { 36 const std::string& application_locale() { return application_locale_; }
38 DCHECK(!application_locale_.empty());
39 return application_locale_;
40 }
41 void set_application_locale(const std::string& locale) { 37 void set_application_locale(const std::string& locale) {
42 application_locale_ = locale; 38 application_locale_ = locale;
43 } 39 }
44 40
45 // The language list. 41 // The language list.
46 TranslateLanguageList* language_list() { return language_list_.get(); } 42 TranslateLanguageList* language_list() { return language_list_.get(); }
47 43
48 // The translate script. 44 // The translate script.
49 TranslateScript* script() { return script_.get(); } 45 TranslateScript* script() { return script_.get(); }
50 46
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 92
97 // An instance of TranslateScript which manages JavaScript source for 93 // An instance of TranslateScript which manages JavaScript source for
98 // Translate. 94 // Translate.
99 scoped_ptr<TranslateScript> script_; 95 scoped_ptr<TranslateScript> script_;
100 96
101 std::string application_locale_; 97 std::string application_locale_;
102 scoped_refptr<net::URLRequestContextGetter> request_context_; 98 scoped_refptr<net::URLRequestContextGetter> request_context_;
103 }; 99 };
104 100
105 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_ 101 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698