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

Side by Side Diff: content/browser/browsing_data/clear_site_data_throttle.h

Issue 2025683003: First experimental implementation of the Clear-Site-Data header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix ListValue iteration. Created 4 years, 6 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 CONTENT_BROWSER_BROWSING_DATA_CLEAR_SITE_DATA_THROTTLE_H_
6 #define CONTENT_BROWSER_BROWSING_DATA_CLEAR_SITE_DATA_THROTTLE_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/values.h"
13 #include "content/public/browser/navigation_throttle.h"
14 #include "content/public/browser/resource_request_info.h"
15 #include "content/public/browser/web_contents_observer.h"
16
17 class Profile;
18
19 namespace content {
20
21 class NavigationHandle;
22
23 // This throttle asynchronously executes the clearing of browsing data.
24 // It does not block navigation.
Mike West 2016/06/02 07:00:08 Aside: I think we might need to reconsider this on
msramek 2016/06/14 20:12:08 Agreed. I have no idea right now which one is the
25 class CONTENT_EXPORT ClearSiteDataThrottle : public NavigationThrottle,
26 public WebContentsObserver {
27 public:
28 static std::unique_ptr<NavigationThrottle>
29 CreateThrottleFor(NavigationHandle* handle);
30
31 ~ClearSiteDataThrottle() override;
32
33 // WebContentsObserver implementation:
34 void DidFinishNavigation(NavigationHandle* handle) override;
35
36 // NavigationThrottle implementation:
37 ThrottleCheckResult WillProcessResponse() override;
38
39 private:
40 friend class ClearSiteDataThrottleTest;
41
42 struct ConsoleMessage {
43 std::string text;
44 bool error;
45 };
46
47 explicit ClearSiteDataThrottle(NavigationHandle* handle);
48
49 // Parses the value of the 'Clear-Site-Data' header and outputs whether
50 // the header requests to |clear_cookies|, |clear_storage|, and |clear_cache|.
51 // Returns true if parsing was successful.
52 bool ParseHeader(const std::string& header,
53 bool* clear_cookies, bool* clear_storage, bool* clear_cache);
54
55 // Console logging.
56 void ConsoleLog(const std::string& text, bool error);
57
58 // Cached console messages to be output when the navigation is ready
59 // to commit.
60 std::vector<ConsoleMessage> messages_;
61
62 DISALLOW_COPY_AND_ASSIGN(ClearSiteDataThrottle);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_BROWSER_BROWSING_DATA_CLEAR_SITE_DATA_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698