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

Unified Diff: ios/chrome/browser/component_updater/component_updater_configurator.cc

Issue 1281913002: Componentize ComponentUpdaterConfigurator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « ios/chrome/browser/component_updater/component_updater_configurator.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/component_updater/component_updater_configurator.cc
diff --git a/ios/chrome/browser/component_updater/component_updater_configurator.cc b/ios/chrome/browser/component_updater/component_updater_configurator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f9e4e238a45747034c739ff2925fd16a96e1cfac
--- /dev/null
+++ b/ios/chrome/browser/component_updater/component_updater_configurator.cc
@@ -0,0 +1,81 @@
+// Copyright 2015 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.
+
+#include "ios/chrome/browser/component_updater/component_updater_configurator.h"
+
+#include <string>
+
+#include "base/threading/sequenced_worker_pool.h"
+#include "components/component_updater/default_configurator.h"
+#include "components/update_client/component_patcher_operation.h"
+#include "components/update_client/update_query_params_delegate.h"
+#include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/common/channel_info.h"
+#include "ios/web/public/web_thread.h"
+
+namespace component_updater {
+
+namespace {
+
+class ChromeConfigurator : public DefaultConfigurator {
+ public:
+ ChromeConfigurator(const base::CommandLine* cmdline,
+ net::URLRequestContextGetter* url_request_getter);
+
+ std::string GetChannel() const override;
+ std::string GetLang() const override;
+ scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher()
+ const override;
+ scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
+ const override;
+ scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner()
+ const override;
+
+ private:
+ friend class base::RefCountedThreadSafe<ChromeConfigurator>;
+
+ ~ChromeConfigurator() override {}
+};
+
+ChromeConfigurator::ChromeConfigurator(
+ const base::CommandLine* cmdline,
+ net::URLRequestContextGetter* url_request_getter)
+ : DefaultConfigurator(cmdline, url_request_getter) {}
+
+std::string ChromeConfigurator::GetChannel() const {
+ return update_client::UpdateQueryParamsDelegate::GetChannelStringHelper(
+ ::GetChannel());
+}
+
+std::string ChromeConfigurator::GetLang() const {
+ return GetApplicationContext()->GetApplicationLocale();
+}
+
+scoped_refptr<update_client::OutOfProcessPatcher>
+ChromeConfigurator::CreateOutOfProcessPatcher() const {
+ return nullptr;
droger 2015/08/07 14:49:44 Is it fine to return null here? On iOS we can't do
Sorin Jianu 2015/08/12 02:27:51 It is correct to return nullptr in this case, acco
+}
+
+scoped_refptr<base::SequencedTaskRunner>
+ChromeConfigurator::GetSequencedTaskRunner() const {
+ return web::WebThread::GetBlockingPool()
+ ->GetSequencedTaskRunnerWithShutdownBehavior(
+ web::WebThread::GetBlockingPool()->GetSequenceToken(),
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
+}
+
+scoped_refptr<base::SingleThreadTaskRunner>
+ChromeConfigurator::GetSingleThreadTaskRunner() const {
+ return web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE);
+}
+
+} // namespace
+
+scoped_refptr<update_client::Configurator> MakeComponentUpdaterConfigurator(
+ const base::CommandLine* cmdline,
+ net::URLRequestContextGetter* context_getter) {
+ return new ChromeConfigurator(cmdline, context_getter);
+}
+
+} // namespace component_updater
« no previous file with comments | « ios/chrome/browser/component_updater/component_updater_configurator.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698