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

Unified Diff: components/translate/core/browser/translate_download_manager.h

Issue 145023015: Introduce TranslateService and TranslateDownloadManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/translate_download_manager.h
diff --git a/components/translate/core/browser/translate_download_manager.h b/components/translate/core/browser/translate_download_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6230d361bb0e6cd18cac9c1e762bb6254e92c563
--- /dev/null
+++ b/components/translate/core/browser/translate_download_manager.h
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_
+#define COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "net/url_request/url_request_context_getter.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+// Manages the downloaded resources for Translate, such as the translate script
+// and the language list.
+// TODO(droger): TranslateDownloadManager should own TranslateLanguageList and
+// TranslateScript.
blundell 2014/01/27 16:02:33 bug?
+class TranslateDownloadManager {
+ public:
+ // Returns the singleton instance.
+ static TranslateDownloadManager* GetInstance();
+
+ // The request context used to download the resources.
+ // Should be set before this class can be used.
blundell 2014/01/27 16:02:33 Can we DCHECK this "should" and the one below?
droger 2014/01/28 14:16:48 Done for the application locale. Tests use a NULL
+ net::URLRequestContextGetter* request_context() { return request_context_; }
+ void set_request_context(net::URLRequestContextGetter* context) {
+ request_context_ = context;
+ }
+
+ // The application locale.
+ // Should be set before this class can be used.
+ const std::string& application_locale() { return application_locale_; }
+ void set_application_locale(const std::string& locale) {
+ application_locale_ = locale;
+ }
+
+ private:
+ friend struct DefaultSingletonTraits<TranslateDownloadManager>;
+ TranslateDownloadManager();
+ virtual ~TranslateDownloadManager();
+
+ std::string application_locale_;
+ scoped_refptr<net::URLRequestContextGetter> request_context_;
+};
+
+#endif // COMPONENTS_TRANSLATE_CORE_BROWER_TRANSLATE_DOWNLOAD_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698