OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/message_loop/message_loop_proxy.h" | |
17 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 17 #include "base/single_thread_task_runner.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/thread_task_runner_handle.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h" | 21 #include "chrome/browser/chromeos/policy/cloud_external_data_store.h" |
21 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 22 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
22 #include "components/policy/core/common/cloud/external_policy_data_fetcher.h" | 23 #include "components/policy/core/common/cloud/external_policy_data_fetcher.h" |
23 #include "components/policy/core/common/cloud/external_policy_data_updater.h" | 24 #include "components/policy/core/common/cloud/external_policy_data_updater.h" |
24 #include "components/policy/core/common/external_data_fetcher.h" | 25 #include "components/policy/core/common/external_data_fetcher.h" |
25 #include "components/policy/core/common/policy_map.h" | 26 #include "components/policy/core/common/policy_map.h" |
26 #include "net/url_request/url_request_context_getter.h" | 27 #include "net/url_request/url_request_context_getter.h" |
27 | 28 |
28 namespace policy { | 29 namespace policy { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 337 } |
337 | 338 |
338 CloudExternalDataManagerBase::CloudExternalDataManagerBase( | 339 CloudExternalDataManagerBase::CloudExternalDataManagerBase( |
339 const GetChromePolicyDetailsCallback& get_policy_details, | 340 const GetChromePolicyDetailsCallback& get_policy_details, |
340 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, | 341 scoped_refptr<base::SequencedTaskRunner> backend_task_runner, |
341 scoped_refptr<base::SequencedTaskRunner> io_task_runner) | 342 scoped_refptr<base::SequencedTaskRunner> io_task_runner) |
342 : backend_task_runner_(backend_task_runner), | 343 : backend_task_runner_(backend_task_runner), |
343 io_task_runner_(io_task_runner), | 344 io_task_runner_(io_task_runner), |
344 backend_(new Backend(get_policy_details, | 345 backend_(new Backend(get_policy_details, |
345 backend_task_runner_, | 346 backend_task_runner_, |
346 base::MessageLoopProxy::current())) { | 347 base::ThreadTaskRunnerHandle::Get())) { |
347 } | 348 } |
348 | 349 |
349 CloudExternalDataManagerBase::~CloudExternalDataManagerBase() { | 350 CloudExternalDataManagerBase::~CloudExternalDataManagerBase() { |
350 DCHECK(CalledOnValidThread()); | 351 DCHECK(CalledOnValidThread()); |
351 io_task_runner_->DeleteSoon(FROM_HERE, | 352 io_task_runner_->DeleteSoon(FROM_HERE, |
352 external_policy_data_fetcher_backend_.release()); | 353 external_policy_data_fetcher_backend_.release()); |
353 backend_task_runner_->DeleteSoon(FROM_HERE, backend_.release()); | 354 backend_task_runner_->DeleteSoon(FROM_HERE, backend_.release()); |
354 } | 355 } |
355 | 356 |
356 void CloudExternalDataManagerBase::SetExternalDataStore( | 357 void CloudExternalDataManagerBase::SetExternalDataStore( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 max_external_data_size_for_testing = max_size; | 441 max_external_data_size_for_testing = max_size; |
441 } | 442 } |
442 | 443 |
443 void CloudExternalDataManagerBase::FetchAll() { | 444 void CloudExternalDataManagerBase::FetchAll() { |
444 DCHECK(CalledOnValidThread()); | 445 DCHECK(CalledOnValidThread()); |
445 backend_task_runner_->PostTask(FROM_HERE, base::Bind( | 446 backend_task_runner_->PostTask(FROM_HERE, base::Bind( |
446 &Backend::FetchAll, base::Unretained(backend_.get()))); | 447 &Backend::FetchAll, base::Unretained(backend_.get()))); |
447 } | 448 } |
448 | 449 |
449 } // namespace policy | 450 } // namespace policy |
OLD | NEW |