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

Side by Side Diff: webkit/quota/mock_special_storage_policy.h

Issue 7619010: Session-only local storage cleared on exit. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Code review comments (tiny). Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_ 5 #ifndef WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
6 #define WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_ 6 #define WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "webkit/quota/special_storage_policy.h" 11 #include "webkit/quota/special_storage_policy.h"
12 12
13 namespace quota { 13 namespace quota {
14 14
15 class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy { 15 class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
16 public: 16 public:
17 MockSpecialStoragePolicy(); 17 MockSpecialStoragePolicy();
18 virtual ~MockSpecialStoragePolicy(); 18 virtual ~MockSpecialStoragePolicy();
19 19
20 virtual bool IsStorageProtected(const GURL& origin); 20 virtual bool IsStorageProtected(const GURL& origin);
21 virtual bool IsStorageUnlimited(const GURL& origin); 21 virtual bool IsStorageUnlimited(const GURL& origin);
22 virtual bool IsStorageSessionOnly(const GURL& origin);
22 virtual bool IsFileHandler(const std::string& extension_id); 23 virtual bool IsFileHandler(const std::string& extension_id);
23 24
24 void AddProtected(const GURL& origin) { 25 void AddProtected(const GURL& origin) {
25 protected_.insert(origin); 26 protected_.insert(origin);
26 } 27 }
27 28
28 void AddUnlimited(const GURL& origin) { 29 void AddUnlimited(const GURL& origin) {
29 unlimited_.insert(origin); 30 unlimited_.insert(origin);
30 } 31 }
31 32
33 void AddSessionOnly(const GURL& origin) {
34 session_only_.insert(origin);
35 }
36
32 void AddFileHandler(const std::string& id) { 37 void AddFileHandler(const std::string& id) {
33 file_handlers_.insert(id); 38 file_handlers_.insert(id);
34 } 39 }
35 40
36 void SetAllUnlimited(bool all_unlimited) { 41 void SetAllUnlimited(bool all_unlimited) {
37 all_unlimited_ = all_unlimited; 42 all_unlimited_ = all_unlimited;
38 } 43 }
39 44
40 void Reset() { 45 void Reset() {
41 protected_.clear(); 46 protected_.clear();
42 unlimited_.clear(); 47 unlimited_.clear();
48 session_only_.clear();
43 file_handlers_.clear(); 49 file_handlers_.clear();
50 all_unlimited_ = false;
44 } 51 }
45 52
46 void NotifyChanged() { 53 void NotifyChanged() {
47 SpecialStoragePolicy::NotifyObservers(); 54 SpecialStoragePolicy::NotifyObservers();
48 } 55 }
49 56
50 private: 57 private:
51 std::set<GURL> protected_; 58 std::set<GURL> protected_;
52 std::set<GURL> unlimited_; 59 std::set<GURL> unlimited_;
60 std::set<GURL> session_only_;
53 std::set<std::string> file_handlers_; 61 std::set<std::string> file_handlers_;
54 62
55 bool all_unlimited_; 63 bool all_unlimited_;
56 }; 64 };
57 } // namespace quota 65 } // namespace quota
58 66
59 #endif // WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_ 67 #endif // WEBKIT_QUOTA_MOCK_SPECIAL_STORAGE_POLICY_H_
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/webkit_context.cc ('k') | webkit/quota/mock_special_storage_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698