| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return *reinterpret_cast<const size_t*>(bytes_.data()); | 84 return *reinterpret_cast<const size_t*>(bytes_.data()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SupervisedUserSiteList::Load(const std::string& id, | 87 void SupervisedUserSiteList::Load(const std::string& id, |
| 88 const base::string16& title, | 88 const base::string16& title, |
| 89 const base::FilePath& large_icon_path, | 89 const base::FilePath& large_icon_path, |
| 90 const base::FilePath& path, | 90 const base::FilePath& path, |
| 91 const LoadedCallback& callback) { | 91 const LoadedCallback& callback) { |
| 92 base::PostTaskWithTraitsAndReplyWithResult( | 92 base::PostTaskWithTraitsAndReplyWithResult( |
| 93 FROM_HERE, | 93 FROM_HERE, |
| 94 base::TaskTraits() | 94 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 95 .MayBlock() | 95 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
| 96 .WithPriority(base::TaskPriority::BACKGROUND) | |
| 97 .WithShutdownBehavior( | |
| 98 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | |
| 99 base::BindOnce(&ReadFileOnBlockingThread, path), | 96 base::BindOnce(&ReadFileOnBlockingThread, path), |
| 100 base::BindOnce(&SupervisedUserSiteList::OnJsonLoaded, id, title, | 97 base::BindOnce(&SupervisedUserSiteList::OnJsonLoaded, id, title, |
| 101 large_icon_path, path, base::TimeTicks::Now(), callback)); | 98 large_icon_path, path, base::TimeTicks::Now(), callback)); |
| 102 } | 99 } |
| 103 | 100 |
| 104 SupervisedUserSiteList::SupervisedUserSiteList( | 101 SupervisedUserSiteList::SupervisedUserSiteList( |
| 105 const std::string& id, | 102 const std::string& id, |
| 106 const base::string16& title, | 103 const base::string16& title, |
| 107 const GURL& entry_point, | 104 const GURL& entry_point, |
| 108 const base::FilePath& large_icon_path, | 105 const base::FilePath& large_icon_path, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 base::ListValue* patterns = nullptr; | 188 base::ListValue* patterns = nullptr; |
| 192 dict->GetList(kWhitelistKey, &patterns); | 189 dict->GetList(kWhitelistKey, &patterns); |
| 193 | 190 |
| 194 base::ListValue* hostname_hashes = nullptr; | 191 base::ListValue* hostname_hashes = nullptr; |
| 195 dict->GetList(kHostnameHashesKey, &hostname_hashes); | 192 dict->GetList(kHostnameHashesKey, &hostname_hashes); |
| 196 | 193 |
| 197 callback.Run(make_scoped_refptr( | 194 callback.Run(make_scoped_refptr( |
| 198 new SupervisedUserSiteList(id, title, GURL(entry_point_url), | 195 new SupervisedUserSiteList(id, title, GURL(entry_point_url), |
| 199 large_icon_path, patterns, hostname_hashes))); | 196 large_icon_path, patterns, hostname_hashes))); |
| 200 } | 197 } |
| OLD | NEW |