OLD | NEW |
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 // Defines the Chrome Extensions Clear API functions, which entail | 5 // Defines the Chrome Extensions Clear API functions, which entail |
6 // clearing browsing data, and clearing the browser's cache (which, let's be | 6 // clearing browsing data, and clearing the browser's cache (which, let's be |
7 // honest, are the same thing), as specified in | 7 // honest, are the same thing), as specified in |
8 // chrome/common/extensions/api/extension_api.json. | 8 // chrome/common/extensions/api/extension_api.json. |
9 | 9 |
10 #include "chrome/browser/extensions/extension_clear_api.h" | 10 #include "chrome/browser/extensions/extension_clear_api.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if (DataRemovalRequested(value, keys::kDownloadsKey)) | 64 if (DataRemovalRequested(value, keys::kDownloadsKey)) |
65 GetRemovalMask |= BrowsingDataRemover::REMOVE_DOWNLOADS; | 65 GetRemovalMask |= BrowsingDataRemover::REMOVE_DOWNLOADS; |
66 if (DataRemovalRequested(value, keys::kFormDataKey)) | 66 if (DataRemovalRequested(value, keys::kFormDataKey)) |
67 GetRemovalMask |= BrowsingDataRemover::REMOVE_FORM_DATA; | 67 GetRemovalMask |= BrowsingDataRemover::REMOVE_FORM_DATA; |
68 if (DataRemovalRequested(value, keys::kHistoryKey)) | 68 if (DataRemovalRequested(value, keys::kHistoryKey)) |
69 GetRemovalMask |= BrowsingDataRemover::REMOVE_HISTORY; | 69 GetRemovalMask |= BrowsingDataRemover::REMOVE_HISTORY; |
70 if (DataRemovalRequested(value, keys::kPasswordsKey)) | 70 if (DataRemovalRequested(value, keys::kPasswordsKey)) |
71 GetRemovalMask |= BrowsingDataRemover::REMOVE_PASSWORDS; | 71 GetRemovalMask |= BrowsingDataRemover::REMOVE_PASSWORDS; |
72 | 72 |
73 // When we talk users about "cookies", we mean not just cookies, but pretty | 73 // When we talk users about "cookies", we mean not just cookies, but pretty |
74 // much everything associated with an origin. To that end, we explicitly | 74 // much everything associated with an origin. |
75 // include the REMOVE_LSO_DATA mask here, and BrowsingDataRemover interprets | 75 if (DataRemovalRequested(value, keys::kCookiesKey)) |
76 // the REMOVE_COOKIES mask internally as "cookies and site data". | 76 GetRemovalMask |= BrowsingDataRemover::REMOVE_SITE_DATA; |
77 if (DataRemovalRequested(value, keys::kCookiesKey)) { | |
78 GetRemovalMask |= BrowsingDataRemover::REMOVE_COOKIES; | |
79 GetRemovalMask |= BrowsingDataRemover::REMOVE_LSO_DATA; | |
80 } | |
81 | 77 |
82 return GetRemovalMask; | 78 return GetRemovalMask; |
83 } | 79 } |
84 | 80 |
85 } // Namespace. | 81 } // Namespace. |
86 | 82 |
87 void BrowsingDataExtensionFunction::OnBrowsingDataRemoverDone() { | 83 void BrowsingDataExtensionFunction::OnBrowsingDataRemoverDone() { |
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
89 this->SendResponse(true); | 85 this->SendResponse(true); |
90 | 86 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return ParseRemovalMask(data_to_remove); | 122 return ParseRemovalMask(data_to_remove); |
127 else | 123 else |
128 return 0; | 124 return 0; |
129 } | 125 } |
130 | 126 |
131 int ClearCacheFunction::GetRemovalMask() const { | 127 int ClearCacheFunction::GetRemovalMask() const { |
132 return BrowsingDataRemover::REMOVE_CACHE; | 128 return BrowsingDataRemover::REMOVE_CACHE; |
133 } | 129 } |
134 | 130 |
135 int ClearCookiesFunction::GetRemovalMask() const { | 131 int ClearCookiesFunction::GetRemovalMask() const { |
136 return BrowsingDataRemover::REMOVE_COOKIES | | 132 return BrowsingDataRemover::REMOVE_SITE_DATA; |
137 BrowsingDataRemover::REMOVE_LSO_DATA; | |
138 } | 133 } |
139 | 134 |
140 int ClearDownloadsFunction::GetRemovalMask() const { | 135 int ClearDownloadsFunction::GetRemovalMask() const { |
141 return BrowsingDataRemover::REMOVE_DOWNLOADS; | 136 return BrowsingDataRemover::REMOVE_DOWNLOADS; |
142 } | 137 } |
143 | 138 |
144 int ClearFormDataFunction::GetRemovalMask() const { | 139 int ClearFormDataFunction::GetRemovalMask() const { |
145 return BrowsingDataRemover::REMOVE_FORM_DATA; | 140 return BrowsingDataRemover::REMOVE_FORM_DATA; |
146 } | 141 } |
147 | 142 |
148 int ClearHistoryFunction::GetRemovalMask() const { | 143 int ClearHistoryFunction::GetRemovalMask() const { |
149 return BrowsingDataRemover::REMOVE_HISTORY; | 144 return BrowsingDataRemover::REMOVE_HISTORY; |
150 } | 145 } |
151 | 146 |
152 int ClearPasswordsFunction::GetRemovalMask() const { | 147 int ClearPasswordsFunction::GetRemovalMask() const { |
153 return BrowsingDataRemover::REMOVE_CACHE; | 148 return BrowsingDataRemover::REMOVE_CACHE; |
154 } | 149 } |
OLD | NEW |