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

Side by Side Diff: chrome/browser/cookies_tree_model.cc

Issue 8383004: Adding CookieSettings for storing cookie content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 #include "chrome/browser/cookies_tree_model.h" 5 #include "chrome/browser/cookies_tree_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/browsing_data_cookie_helper.h" 17 #include "chrome/browser/browsing_data_cookie_helper.h"
18 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/cookie_settings.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "content/browser/in_process_webkit/webkit_context.h" 20 #include "content/browser/in_process_webkit/webkit_context.h"
21 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
22 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
23 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
24 #include "net/base/cookie_monster.h" 24 #include "net/base/cookie_monster.h"
25 #include "net/base/registry_controlled_domain.h" 25 #include "net/base/registry_controlled_domain.h"
26 #include "net/url_request/url_request_context.h" 26 #include "net/url_request/url_request_context.h"
27 #include "third_party/skia/include/core/SkBitmap.h" 27 #include "third_party/skia/include/core/SkBitmap.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode( 446 CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode(
447 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) { 447 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) {
448 if (quota_child_) 448 if (quota_child_)
449 return quota_child_; 449 return quota_child_;
450 quota_child_ = new CookieTreeQuotaNode(quota_info); 450 quota_child_ = new CookieTreeQuotaNode(quota_info);
451 AddChildSortedByTitle(quota_child_); 451 AddChildSortedByTitle(quota_child_);
452 return quota_child_; 452 return quota_child_;
453 } 453 }
454 454
455 void CookieTreeOriginNode::CreateContentException( 455 void CookieTreeOriginNode::CreateContentException(
456 HostContentSettingsMap* content_settings, ContentSetting setting) const { 456 CookieSettings* cookie_settings, ContentSetting setting) const {
457 DCHECK(setting == CONTENT_SETTING_ALLOW ||
458 setting == CONTENT_SETTING_BLOCK ||
459 setting == CONTENT_SETTING_SESSION_ONLY);
457 if (CanCreateContentException()) { 460 if (CanCreateContentException()) {
458 content_settings->AddExceptionForURL(url_, 461 cookie_settings->ResetCookieSetting(
459 url_, 462 ContentSettingsPattern::FromURLNoWildcard(url_));
460 CONTENT_SETTINGS_TYPE_COOKIES, 463 cookie_settings->SetCookieSetting(
461 "", 464 ContentSettingsPattern::FromURL(url_), setting);
462 setting);
463 } 465 }
464 } 466 }
465 467
466 bool CookieTreeOriginNode::CanCreateContentException() const { 468 bool CookieTreeOriginNode::CanCreateContentException() const {
467 return !url_.SchemeIsFile(); 469 return !url_.SchemeIsFile();
468 } 470 }
469 471
470 /////////////////////////////////////////////////////////////////////////////// 472 ///////////////////////////////////////////////////////////////////////////////
471 // CookieTreeCookiesNode, public: 473 // CookieTreeCookiesNode, public:
472 474
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1073
1072 void CookiesTreeModel::NotifyObserverEndBatch() { 1074 void CookiesTreeModel::NotifyObserverEndBatch() {
1073 // Only notify the observers if this is the outermost call to EndBatch() if 1075 // Only notify the observers if this is the outermost call to EndBatch() if
1074 // called in a nested manner. 1076 // called in a nested manner.
1075 if (--batch_update_ == 0) { 1077 if (--batch_update_ == 0) {
1076 FOR_EACH_OBSERVER(Observer, 1078 FOR_EACH_OBSERVER(Observer,
1077 cookies_observer_list_, 1079 cookies_observer_list_,
1078 TreeModelEndBatch(this)); 1080 TreeModelEndBatch(this));
1079 } 1081 }
1080 } 1082 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698