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 #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/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browsing_data_cookie_helper.h" | 16 #include "chrome/browser/browsing_data_cookie_helper.h" |
| 17 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 18 #include "chrome/browser/content_settings/cookie_settings.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
19 #include "content/browser/in_process_webkit/webkit_context.h" | 21 #include "content/browser/in_process_webkit/webkit_context.h" |
20 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
22 #include "grit/ui_resources.h" | 24 #include "grit/ui_resources.h" |
23 #include "net/base/cookie_monster.h" | 25 #include "net/base/cookie_monster.h" |
24 #include "net/base/registry_controlled_domain.h" | 26 #include "net/base/registry_controlled_domain.h" |
25 #include "net/url_request/url_request_context.h" | 27 #include "net/url_request/url_request_context.h" |
26 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode( | 445 CookieTreeQuotaNode* CookieTreeOriginNode::UpdateOrCreateQuotaNode( |
444 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) { | 446 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info) { |
445 if (quota_child_) | 447 if (quota_child_) |
446 return quota_child_; | 448 return quota_child_; |
447 quota_child_ = new CookieTreeQuotaNode(quota_info); | 449 quota_child_ = new CookieTreeQuotaNode(quota_info); |
448 AddChildSortedByTitle(quota_child_); | 450 AddChildSortedByTitle(quota_child_); |
449 return quota_child_; | 451 return quota_child_; |
450 } | 452 } |
451 | 453 |
452 void CookieTreeOriginNode::CreateContentException( | 454 void CookieTreeOriginNode::CreateContentException( |
453 HostContentSettingsMap* content_settings, ContentSetting setting) const { | 455 CookieSettings* cookie_settings, |
| 456 ContentSetting setting) const { |
454 if (CanCreateContentException()) { | 457 if (CanCreateContentException()) { |
455 content_settings->AddExceptionForURL(url_, | 458 cookie_settings->ResetCookieSetting( |
456 url_, | 459 ContentSettingsPattern::FromURLNoWildcard(url_)); |
457 CONTENT_SETTINGS_TYPE_COOKIES, | 460 cookie_settings->SetCookieSetting(ContentSettingsPattern::FromURL(url_), |
458 "", | 461 setting); |
459 setting); | |
460 } | 462 } |
461 } | 463 } |
462 | 464 |
463 bool CookieTreeOriginNode::CanCreateContentException() const { | 465 bool CookieTreeOriginNode::CanCreateContentException() const { |
464 return !url_.SchemeIsFile(); | 466 return !url_.SchemeIsFile(); |
465 } | 467 } |
466 | 468 |
467 /////////////////////////////////////////////////////////////////////////////// | 469 /////////////////////////////////////////////////////////////////////////////// |
468 // CookieTreeCookiesNode, public: | 470 // CookieTreeCookiesNode, public: |
469 | 471 |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 | 1068 |
1067 void CookiesTreeModel::NotifyObserverEndBatch() { | 1069 void CookiesTreeModel::NotifyObserverEndBatch() { |
1068 // Only notify the observers if this is the outermost call to EndBatch() if | 1070 // Only notify the observers if this is the outermost call to EndBatch() if |
1069 // called in a nested manner. | 1071 // called in a nested manner. |
1070 if (--batch_update_ == 0) { | 1072 if (--batch_update_ == 0) { |
1071 FOR_EACH_OBSERVER(Observer, | 1073 FOR_EACH_OBSERVER(Observer, |
1072 cookies_observer_list_, | 1074 cookies_observer_list_, |
1073 TreeModelEndBatch(this)); | 1075 TreeModelEndBatch(this)); |
1074 } | 1076 } |
1075 } | 1077 } |
OLD | NEW |