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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_media_license_helper.h

Issue 2359393002: Adds media license nodes to cookie tree model and cookies view. (Closed)
Patch Set: rebase Created 4 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_MEDIA_LICENSE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_MEDIA_LICENSE_HELPER_H_
7
8 #include <stdint.h>
9 #include <list>
10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/time/time.h"
14 #include "url/gurl.h"
15
16 namespace storage {
17 class FileSystemContext;
18 }
19
20 // Defines an interface for classes that deal with aggregating and deleting
21 // media licenses.
22 // BrowsingDataMediaLicenseHelper instances for a specific profile should
23 // be created via the static Create method. Each instance will lazily fetch
24 // data when a client calls StartFetching from the UI thread, and will
25 // notify the client via a supplied callback when the data is available.
26 //
27 // The client's callback is passed a list of MediaLicenseInfo objects
28 // containing usage information for each origin's media licenses.
29 class BrowsingDataMediaLicenseHelper
30 : public base::RefCountedThreadSafe<BrowsingDataMediaLicenseHelper> {
31 public:
32 // Detailed information about a media license, including it's origin GURL
33 // and the amount of data (in bytes).
34 struct MediaLicenseInfo {
35 MediaLicenseInfo(const GURL& origin,
36 int64_t size,
37 base::Time last_modified_time);
38 MediaLicenseInfo(const MediaLicenseInfo& other);
39 ~MediaLicenseInfo();
40
41 // The origin for which the information is relevant.
42 GURL origin;
43 // Size (in bytes).
44 int64_t size;
45 // Last modified time.
46 base::Time last_modified_time;
47 };
48
49 using FetchCallback =
50 base::Callback<void(const std::list<MediaLicenseInfo>&)>;
51
52 // Creates a BrowsingDataMediaLicenseHelper instance for the media
53 // licenses stored in |profile|'s user data directory. The
54 // BrowsingDataMediaLicenseHelper object will hold a reference to the
55 // Profile that's passed in, but is not responsible for destroying it.
56 //
57 // The BrowsingDataMediaLicenseHelper will not change the profile itself,
58 // but can modify data it contains (by removing media licenses).
59 static BrowsingDataMediaLicenseHelper* Create(
60 storage::FileSystemContext* file_system_context);
61
62 // Starts the process of fetching media license data, which will call
63 // |callback| upon completion, passing it a constant list of
64 // MediaLicenseInfo objects. StartFetching must be called only in the UI
65 // thread; the provided Callback will likewise be executed asynchronously
66 // on the UI thread. Obtaining the data will occur asynchronously on the
67 // FILE thread.
68 virtual void StartFetching(const FetchCallback& callback) = 0;
69
70 // Deletes any media licenses associated with |origin| from the disk.
71 // Deletion will occur asynchronously on the FILE thread, but this function
72 // must be called only on the UI thread.
73 virtual void DeleteMediaLicenseOrigin(const GURL& origin) = 0;
74
75 protected:
76 friend class base::RefCountedThreadSafe<BrowsingDataMediaLicenseHelper>;
77
78 BrowsingDataMediaLicenseHelper() {}
79 virtual ~BrowsingDataMediaLicenseHelper() {}
80 };
81
82 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_MEDIA_LICENSE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698