OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_site_list.h" | 5 #include "chrome/browser/supervised_user/supervised_user_site_list.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 SupervisedUserSiteList::Site::Site(const base::string16& name) : name(name) { | 99 SupervisedUserSiteList::Site::Site(const base::string16& name) : name(name) { |
100 } | 100 } |
101 | 101 |
102 SupervisedUserSiteList::Site::~Site() { | 102 SupervisedUserSiteList::Site::~Site() { |
103 } | 103 } |
104 | 104 |
105 void SupervisedUserSiteList::Load(const base::FilePath& path, | 105 void SupervisedUserSiteList::Load(const base::FilePath& path, |
106 const LoadedCallback& callback) { | 106 const LoadedCallback& callback) { |
107 base::PostTaskAndReplyWithResult( | 107 base::PostTaskAndReplyWithResult( |
108 content::BrowserThread::GetBlockingPool(), | 108 content::BrowserThread::GetBlockingPool() |
| 109 ->GetTaskRunnerWithShutdownBehavior( |
| 110 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN).get(), |
109 FROM_HERE, | 111 FROM_HERE, |
110 base::Bind(&ReadFileOnBlockingThread, path), | 112 base::Bind(&ReadFileOnBlockingThread, path), |
111 base::Bind(&SupervisedUserSiteList::ParseJson, path, callback)); | 113 base::Bind(&SupervisedUserSiteList::ParseJson, path, callback)); |
112 } | 114 } |
113 | 115 |
114 // static | 116 // static |
115 void SupervisedUserSiteList::SetLoadInProcessForTesting(bool in_process) { | 117 void SupervisedUserSiteList::SetLoadInProcessForTesting(bool in_process) { |
116 g_load_in_process = in_process; | 118 g_load_in_process = in_process; |
117 } | 119 } |
118 | 120 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 193 |
192 base::ListValue* sites = nullptr; | 194 base::ListValue* sites = nullptr; |
193 if (!dict->GetList(kSitesKey, &sites)) { | 195 if (!dict->GetList(kSitesKey, &sites)) { |
194 LOG(ERROR) << "Site list " << path.value() | 196 LOG(ERROR) << "Site list " << path.value() |
195 << " does not contain any sites"; | 197 << " does not contain any sites"; |
196 return; | 198 return; |
197 } | 199 } |
198 | 200 |
199 callback.Run(make_scoped_refptr(new SupervisedUserSiteList(*sites))); | 201 callback.Run(make_scoped_refptr(new SupervisedUserSiteList(*sites))); |
200 } | 202 } |
OLD | NEW |