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

Side by Side Diff: chrome/browser/chromeos/policy/user_policy_token_loader.cc

Issue 1118773004: [chrome/browser/chromeos/policy] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments->2 Created 5 years, 7 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
« no previous file with comments | « chrome/browser/chromeos/policy/user_policy_disk_cache.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/user_policy_token_loader.h" 5 #include "chrome/browser/chromeos/policy/user_policy_token_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
12 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h"
13 #include "components/policy/core/common/cloud/enterprise_metrics.h" 14 #include "components/policy/core/common/cloud/enterprise_metrics.h"
14 #include "policy/proto/device_management_local.pb.h" 15 #include "policy/proto/device_management_local.pb.h"
15 16
16 namespace policy { 17 namespace policy {
17 18
18 namespace em = enterprise_management; 19 namespace em = enterprise_management;
19 20
20 UserPolicyTokenLoader::Delegate::~Delegate() {} 21 UserPolicyTokenLoader::Delegate::~Delegate() {}
21 22
22 UserPolicyTokenLoader::UserPolicyTokenLoader( 23 UserPolicyTokenLoader::UserPolicyTokenLoader(
23 const base::WeakPtr<Delegate>& delegate, 24 const base::WeakPtr<Delegate>& delegate,
24 const base::FilePath& cache_file, 25 const base::FilePath& cache_file,
25 scoped_refptr<base::SequencedTaskRunner> background_task_runner) 26 scoped_refptr<base::SequencedTaskRunner> background_task_runner)
26 : delegate_(delegate), 27 : delegate_(delegate),
27 cache_file_(cache_file), 28 cache_file_(cache_file),
28 origin_task_runner_(base::MessageLoopProxy::current()), 29 origin_task_runner_(base::ThreadTaskRunnerHandle::Get()),
29 background_task_runner_(background_task_runner) {} 30 background_task_runner_(background_task_runner) {
31 }
30 32
31 void UserPolicyTokenLoader::Load() { 33 void UserPolicyTokenLoader::Load() {
32 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); 34 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
33 background_task_runner_->PostTask( 35 background_task_runner_->PostTask(
34 FROM_HERE, 36 FROM_HERE,
35 base::Bind(&UserPolicyTokenLoader::LoadOnBackgroundThread, this)); 37 base::Bind(&UserPolicyTokenLoader::LoadOnBackgroundThread, this));
36 } 38 }
37 39
38 UserPolicyTokenLoader::~UserPolicyTokenLoader() { 40 UserPolicyTokenLoader::~UserPolicyTokenLoader() {
39 } 41 }
(...skipping 29 matching lines...) Expand all
69 } 71 }
70 72
71 void UserPolicyTokenLoader::NotifyOnOriginThread(const std::string& token, 73 void UserPolicyTokenLoader::NotifyOnOriginThread(const std::string& token,
72 const std::string& device_id) { 74 const std::string& device_id) {
73 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); 75 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
74 if (delegate_.get()) 76 if (delegate_.get())
75 delegate_->OnTokenLoaded(token, device_id); 77 delegate_->OnTokenLoaded(token, device_id);
76 } 78 }
77 79
78 } // namespace policy 80 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/user_policy_disk_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698