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

Side by Side Diff: chrome/browser/ui/webui/options2/cookies_view_handler.cc

Issue 10709006: Show apps protecting local data in chrome://settings/cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: argh Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/options2/cookies_view_handler.h" 5 #include "chrome/browser/ui/webui/options2/cookies_view_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL }, 84 IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL },
85 { "cookie_server_bound_cert", IDS_COOKIES_SERVER_BOUND_CERT }, 85 { "cookie_server_bound_cert", IDS_COOKIES_SERVER_BOUND_CERT },
86 { "label_server_bound_cert_server_id", 86 { "label_server_bound_cert_server_id",
87 IDS_COOKIES_SERVER_BOUND_CERT_ORIGIN_LABEL }, 87 IDS_COOKIES_SERVER_BOUND_CERT_ORIGIN_LABEL },
88 { "label_server_bound_cert_type", 88 { "label_server_bound_cert_type",
89 IDS_COOKIES_SERVER_BOUND_CERT_TYPE_LABEL }, 89 IDS_COOKIES_SERVER_BOUND_CERT_TYPE_LABEL },
90 { "label_server_bound_cert_created", 90 { "label_server_bound_cert_created",
91 IDS_COOKIES_SERVER_BOUND_CERT_CREATED_LABEL }, 91 IDS_COOKIES_SERVER_BOUND_CERT_CREATED_LABEL },
92 { "label_server_bound_cert_expires", 92 { "label_server_bound_cert_expires",
93 IDS_COOKIES_SERVER_BOUND_CERT_EXPIRES_LABEL }, 93 IDS_COOKIES_SERVER_BOUND_CERT_EXPIRES_LABEL },
94 { "label_protected_by_apps",
95 IDS_GEOLOCATION_SET_BY_HOVER }, // TODO(bauerb): Use a better string
94 }; 96 };
95 97
96 RegisterStrings(localized_strings, resources, arraysize(resources)); 98 RegisterStrings(localized_strings, resources, arraysize(resources));
97 RegisterTitle(localized_strings, "cookiesViewPage", 99 RegisterTitle(localized_strings, "cookiesViewPage",
98 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); 100 IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE);
99 RegisterTitle(localized_strings, "appCookiesViewPage", 101 RegisterTitle(localized_strings, "appCookiesViewPage",
100 IDS_APP_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); 102 IDS_APP_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE);
101 } 103 }
102 104
103 void CookiesViewHandler::RegisterMessages() { 105 void CookiesViewHandler::RegisterMessages() {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 "Site Data", std::string(), 187 "Site Data", std::string(),
186 new BrowsingDataCookieHelper(profile->GetRequestContext()), 188 new BrowsingDataCookieHelper(profile->GetRequestContext()),
187 new BrowsingDataDatabaseHelper(profile), 189 new BrowsingDataDatabaseHelper(profile),
188 new BrowsingDataLocalStorageHelper(profile), 190 new BrowsingDataLocalStorageHelper(profile),
189 NULL, 191 NULL,
190 new BrowsingDataAppCacheHelper(profile), 192 new BrowsingDataAppCacheHelper(profile),
191 BrowsingDataIndexedDBHelper::Create(profile), 193 BrowsingDataIndexedDBHelper::Create(profile),
192 BrowsingDataFileSystemHelper::Create(profile), 194 BrowsingDataFileSystemHelper::Create(profile),
193 BrowsingDataQuotaHelper::Create(profile), 195 BrowsingDataQuotaHelper::Create(profile),
194 BrowsingDataServerBoundCertHelper::Create(profile)); 196 BrowsingDataServerBoundCertHelper::Create(profile));
195 cookies_tree_model_.reset(new CookiesTreeModel(apps_map, false)); 197 cookies_tree_model_.reset(
198 new CookiesTreeModel(apps_map,
199 profile->GetExtensionSpecialStoragePolicy(),
200 false));
196 cookies_tree_model_->AddCookiesTreeObserver(this); 201 cookies_tree_model_->AddCookiesTreeObserver(this);
197 } 202 }
198 203
199 if (app_context_ && !app_cookies_tree_model_.get()) { 204 if (app_context_ && !app_cookies_tree_model_.get()) {
200 Profile* profile = Profile::FromWebUI(web_ui()); 205 Profile* profile = Profile::FromWebUI(web_ui());
201 ContainerMap apps_map; 206 ContainerMap apps_map;
202 const ExtensionService* service = profile->GetExtensionService(); 207 const ExtensionService* service = profile->GetExtensionService();
203 if (service) { 208 if (service) {
204 const ExtensionSet* extensions = service->extensions(); 209 const ExtensionSet* extensions = service->extensions();
205 for (ExtensionSet::const_iterator it = extensions->begin(); 210 for (ExtensionSet::const_iterator it = extensions->begin();
206 it != extensions->end(); ++it) { 211 it != extensions->end(); ++it) {
207 if ((*it)->is_storage_isolated()) { 212 if ((*it)->is_storage_isolated()) {
208 net::URLRequestContextGetter* context_getter = 213 net::URLRequestContextGetter* context_getter =
209 profile->GetRequestContextForIsolatedApp((*it)->id()); 214 profile->GetRequestContextForIsolatedApp((*it)->id());
210 // TODO(nasko): When new types of storage are isolated, add the 215 // TODO(nasko): When new types of storage are isolated, add the
211 // appropriate browsing data helper objects to the constructor. 216 // appropriate browsing data helper objects to the constructor.
212 // For now, just cookies are isolated, so other parameters are NULL. 217 // For now, just cookies are isolated, so other parameters are NULL.
213 apps_map[(*it)->id()] = new LocalDataContainer( 218 apps_map[(*it)->id()] = new LocalDataContainer(
214 (*it)->name(), (*it)->id(), 219 (*it)->name(), (*it)->id(),
215 new BrowsingDataCookieHelper(context_getter), 220 new BrowsingDataCookieHelper(context_getter),
216 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 221 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
217 } 222 }
218 } 223 }
219 app_cookies_tree_model_.reset(new CookiesTreeModel(apps_map, false)); 224 app_cookies_tree_model_.reset(
225 new CookiesTreeModel(apps_map,
226 profile->GetExtensionSpecialStoragePolicy(),
227 false));
220 app_cookies_tree_model_->AddCookiesTreeObserver(this); 228 app_cookies_tree_model_->AddCookiesTreeObserver(this);
221 } 229 }
222 } 230 }
223 } 231 }
224 232
225 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { 233 void CookiesViewHandler::UpdateSearchResults(const ListValue* args) {
226 string16 query; 234 string16 query;
227 if (!args->GetString(0, &query)) { 235 if (!args->GetString(0, &query))
228 return; 236 return;
229 }
230 237
231 EnsureCookiesTreeModelCreated(); 238 EnsureCookiesTreeModelCreated();
232 239
233 GetTreeModel()->UpdateSearchResults(query); 240 GetTreeModel()->UpdateSearchResults(query);
234 } 241 }
235 242
236 void CookiesViewHandler::RemoveAll(const ListValue* args) { 243 void CookiesViewHandler::RemoveAll(const ListValue* args) {
237 EnsureCookiesTreeModelCreated(); 244 EnsureCookiesTreeModelCreated();
238 GetTreeModel()->DeleteAllStoredObjects(); 245 GetTreeModel()->DeleteAllStoredObjects();
239 } 246 }
240 247
241 void CookiesViewHandler::Remove(const ListValue* args) { 248 void CookiesViewHandler::Remove(const ListValue* args) {
242 std::string node_path; 249 std::string node_path;
243 if (!args->GetString(0, &node_path)) { 250 if (!args->GetString(0, &node_path))
244 return; 251 return;
245 }
246 252
247 EnsureCookiesTreeModelCreated(); 253 EnsureCookiesTreeModelCreated();
248 254
249 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( 255 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath(
250 GetTreeModel()->GetRoot(), node_path); 256 GetTreeModel()->GetRoot(), node_path);
251 if (node) 257 if (node)
252 GetTreeModel()->DeleteCookieNode(const_cast<CookieTreeNode*>(node)); 258 GetTreeModel()->DeleteCookieNode(const_cast<CookieTreeNode*>(node));
253 } 259 }
254 260
255 void CookiesViewHandler::LoadChildren(const ListValue* args) { 261 void CookiesViewHandler::LoadChildren(const ListValue* args) {
256 std::string node_path; 262 std::string node_path;
257 if (!args->GetString(0, &node_path)) { 263 if (!args->GetString(0, &node_path))
258 return; 264 return;
259 }
260 265
261 EnsureCookiesTreeModelCreated(); 266 EnsureCookiesTreeModelCreated();
262 267
263 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( 268 const CookieTreeNode* node = model_util_->GetTreeNodeFromPath(
264 GetTreeModel()->GetRoot(), node_path); 269 GetTreeModel()->GetRoot(), node_path);
265 if (node) 270 if (node)
266 SendChildren(node); 271 SendChildren(node);
267 } 272 }
268 273
269 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { 274 void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) {
(...skipping 27 matching lines...) Expand all
297 std::string CookiesViewHandler::GetCallback( 302 std::string CookiesViewHandler::GetCallback(
298 std::string method, CookiesTreeModel* model) { 303 std::string method, CookiesTreeModel* model) {
299 std::string callback("CookiesView"); 304 std::string callback("CookiesView");
300 305
301 if (model == app_cookies_tree_model_) 306 if (model == app_cookies_tree_model_)
302 callback.append("App"); 307 callback.append("App");
303 return callback.append(".").append(method); 308 return callback.append(".").append(method);
304 } 309 }
305 310
306 } // namespace options2 311 } // namespace options2
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698