OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browsing_data/media_licenses_counter.h" | 5 #include "chrome/browser/browsing_data/media_licenses_counter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "components/browsing_data/core/pref_names.h" | 13 #include "components/browsing_data/core/pref_names.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
16 #include "storage/browser/fileapi/file_system_context.h" | 16 #include "storage/browser/fileapi/file_system_context.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // Determining the origins must be run on the file task thread. | 20 // Determining the origins must be run on the file task thread. |
21 std::set<GURL> CountOriginsOnFileTaskRunner( | 21 std::set<GURL> CountOriginsOnFileTaskRunner( |
22 storage::FileSystemContext* filesystem_context) { | 22 storage::FileSystemContext* filesystem_context) { |
23 DCHECK(filesystem_context->default_file_task_runner() | 23 DCHECK(filesystem_context->default_file_task_runner() |
24 ->RunsTasksOnCurrentThread()); | 24 ->RunsTasksInCurrentSequence()); |
25 | 25 |
26 storage::FileSystemBackend* backend = | 26 storage::FileSystemBackend* backend = |
27 filesystem_context->GetFileSystemBackend( | 27 filesystem_context->GetFileSystemBackend( |
28 storage::kFileSystemTypePluginPrivate); | 28 storage::kFileSystemTypePluginPrivate); |
29 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); | 29 storage::FileSystemQuotaUtil* quota_util = backend->GetQuotaUtil(); |
30 | 30 |
31 std::set<GURL> origins; | 31 std::set<GURL> origins; |
32 quota_util->GetOriginsForTypeOnFileTaskRunner( | 32 quota_util->GetOriginsForTypeOnFileTaskRunner( |
33 storage::kFileSystemTypePluginPrivate, &origins); | 33 storage::kFileSystemTypePluginPrivate, &origins); |
34 return origins; | 34 return origins; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 base::RetainedRef(filesystem_context)), | 75 base::RetainedRef(filesystem_context)), |
76 base::Bind(&MediaLicensesCounter::OnContentLicensesObtained, | 76 base::Bind(&MediaLicensesCounter::OnContentLicensesObtained, |
77 weak_ptr_factory_.GetWeakPtr())); | 77 weak_ptr_factory_.GetWeakPtr())); |
78 } | 78 } |
79 | 79 |
80 void MediaLicensesCounter::OnContentLicensesObtained( | 80 void MediaLicensesCounter::OnContentLicensesObtained( |
81 const std::set<GURL>& origins) { | 81 const std::set<GURL>& origins) { |
82 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 82 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
83 ReportResult(base::MakeUnique<MediaLicenseResult>(this, origins)); | 83 ReportResult(base::MakeUnique<MediaLicenseResult>(this, origins)); |
84 } | 84 } |
OLD | NEW |