Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 #include "ios/chrome/browser/component_updater/component_updater_configurator.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/threading/sequenced_worker_pool.h" | |
| 10 #include "components/component_updater/default_configurator.h" | |
| 11 #include "components/update_client/component_patcher_operation.h" | |
| 12 #include "components/update_client/update_query_params_delegate.h" | |
| 13 #include "ios/chrome/browser/application_context.h" | |
| 14 #include "ios/chrome/common/channel_info.h" | |
| 15 #include "ios/web/public/web_thread.h" | |
| 16 | |
| 17 namespace component_updater { | |
| 18 | |
| 19 namespace { | |
| 20 | |
| 21 class ChromeConfigurator : public DefaultConfigurator { | |
| 22 public: | |
| 23 ChromeConfigurator(const base::CommandLine* cmdline, | |
| 24 net::URLRequestContextGetter* url_request_getter); | |
| 25 | |
| 26 std::string GetChannel() const override; | |
| 27 std::string GetLang() const override; | |
| 28 scoped_refptr<update_client::OutOfProcessPatcher> CreateOutOfProcessPatcher() | |
| 29 const override; | |
| 30 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() | |
| 31 const override; | |
| 32 scoped_refptr<base::SingleThreadTaskRunner> GetSingleThreadTaskRunner() | |
| 33 const override; | |
| 34 | |
| 35 private: | |
| 36 friend class base::RefCountedThreadSafe<ChromeConfigurator>; | |
| 37 | |
| 38 ~ChromeConfigurator() override {} | |
| 39 }; | |
| 40 | |
| 41 ChromeConfigurator::ChromeConfigurator( | |
| 42 const base::CommandLine* cmdline, | |
| 43 net::URLRequestContextGetter* url_request_getter) | |
| 44 : DefaultConfigurator(cmdline, url_request_getter) {} | |
| 45 | |
| 46 std::string ChromeConfigurator::GetChannel() const { | |
| 47 return update_client::UpdateQueryParamsDelegate::GetChannelStringHelper( | |
| 48 ::GetChannel()); | |
| 49 } | |
| 50 | |
| 51 std::string ChromeConfigurator::GetLang() const { | |
| 52 return GetApplicationContext()->GetApplicationLocale(); | |
| 53 } | |
| 54 | |
| 55 scoped_refptr<update_client::OutOfProcessPatcher> | |
| 56 ChromeConfigurator::CreateOutOfProcessPatcher() const { | |
| 57 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
| |
| 58 } | |
| 59 | |
| 60 scoped_refptr<base::SequencedTaskRunner> | |
| 61 ChromeConfigurator::GetSequencedTaskRunner() const { | |
| 62 return web::WebThread::GetBlockingPool() | |
| 63 ->GetSequencedTaskRunnerWithShutdownBehavior( | |
| 64 web::WebThread::GetBlockingPool()->GetSequenceToken(), | |
| 65 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | |
| 66 } | |
| 67 | |
| 68 scoped_refptr<base::SingleThreadTaskRunner> | |
| 69 ChromeConfigurator::GetSingleThreadTaskRunner() const { | |
| 70 return web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE); | |
| 71 } | |
| 72 | |
| 73 } // namespace | |
| 74 | |
| 75 scoped_refptr<update_client::Configurator> MakeComponentUpdaterConfigurator( | |
| 76 const base::CommandLine* cmdline, | |
| 77 net::URLRequestContextGetter* context_getter) { | |
| 78 return new ChromeConfigurator(cmdline, context_getter); | |
| 79 } | |
| 80 | |
| 81 } // namespace component_updater | |
| OLD | NEW |