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

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: Fixing the rebase. 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
« no previous file with comments | « chrome/browser/cookies_tree_model.h ('k') | chrome/browser/cookies_tree_model_unittest.cc » ('j') | 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) 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 ContentSettingsPattern::Wildcard());
461 "", 464 cookie_settings->SetCookieSetting(
462 setting); 465 ContentSettingsPattern::FromURL(url_),
466 ContentSettingsPattern::Wildcard(), setting);
463 } 467 }
464 } 468 }
465 469
466 bool CookieTreeOriginNode::CanCreateContentException() const { 470 bool CookieTreeOriginNode::CanCreateContentException() const {
467 return !url_.SchemeIsFile(); 471 return !url_.SchemeIsFile();
468 } 472 }
469 473
470 /////////////////////////////////////////////////////////////////////////////// 474 ///////////////////////////////////////////////////////////////////////////////
471 // CookieTreeCookiesNode, public: 475 // CookieTreeCookiesNode, public:
472 476
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 1079
1076 void CookiesTreeModel::NotifyObserverEndBatch() { 1080 void CookiesTreeModel::NotifyObserverEndBatch() {
1077 // Only notify the observers if this is the outermost call to EndBatch() if 1081 // Only notify the observers if this is the outermost call to EndBatch() if
1078 // called in a nested manner. 1082 // called in a nested manner.
1079 if (--batch_update_ == 0) { 1083 if (--batch_update_ == 0) {
1080 FOR_EACH_OBSERVER(Observer, 1084 FOR_EACH_OBSERVER(Observer,
1081 cookies_observer_list_, 1085 cookies_observer_list_,
1082 TreeModelEndBatch(this)); 1086 TreeModelEndBatch(this));
1083 } 1087 }
1084 } 1088 }
OLDNEW
« no previous file with comments | « chrome/browser/cookies_tree_model.h ('k') | chrome/browser/cookies_tree_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698