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

Side by Side Diff: chrome/browser/ui/webui/collected_cookies_ui_delegate.cc

Issue 7713034: HostContentSettingsMap refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Tiny fixes (unnecessary #includes, win + mac fixes). Created 9 years, 3 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
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/ui/webui/collected_cookies_ui_delegate.h" 5 #include "chrome/browser/ui/webui/collected_cookies_ui_delegate.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 11 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
12 #include "chrome/browser/cookies_tree_model.h" 13 #include "chrome/browser/cookies_tree_model.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "chrome/browser/ui/webui/constrained_html_ui.h" 17 #include "chrome/browser/ui/webui/constrained_html_ui.h"
17 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" 18 #include "chrome/browser/ui/webui/cookies_tree_model_util.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/jstemplate_builder.h" 20 #include "chrome/common/jstemplate_builder.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 tab_contents); 141 tab_contents);
141 } 142 }
142 143
143 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( 144 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate(
144 TabContents* tab_contents) 145 TabContents* tab_contents)
145 : tab_contents_(tab_contents), 146 : tab_contents_(tab_contents),
146 closed_(false) { 147 closed_(false) {
147 TabContentsWrapper* wrapper = 148 TabContentsWrapper* wrapper =
148 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); 149 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents);
149 TabSpecificContentSettings* content_settings = wrapper->content_settings(); 150 TabSpecificContentSettings* content_settings = wrapper->content_settings();
150 HostContentSettingsMap* host_content_settings_map = 151 CookieSettings* cookie_settings =
151 wrapper->profile()->GetHostContentSettingsMap(); 152 CookieSettings::GetForProfile(wrapper->profile());
152 153
153 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, 154 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN,
154 Source<TabSpecificContentSettings>(content_settings)); 155 Source<TabSpecificContentSettings>(content_settings));
155 156
156 allowed_cookies_tree_model_.reset( 157 allowed_cookies_tree_model_.reset(
157 content_settings->GetAllowedCookiesTreeModel()); 158 content_settings->GetAllowedCookiesTreeModel());
158 blocked_cookies_tree_model_.reset( 159 blocked_cookies_tree_model_.reset(
159 content_settings->GetBlockedCookiesTreeModel()); 160 content_settings->GetBlockedCookiesTreeModel());
160 161
161 CollectedCookiesSource* source = new CollectedCookiesSource( 162 CollectedCookiesSource* source = new CollectedCookiesSource(
162 host_content_settings_map->BlockThirdPartyCookies()); 163 cookie_settings->ShouldBlockThirdPartyCookies());
163 wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source); 164 wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source);
164 } 165 }
165 166
166 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() { 167 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() {
167 } 168 }
168 169
169 bool CollectedCookiesUIDelegate::IsDialogModal() const { 170 bool CollectedCookiesUIDelegate::IsDialogModal() const {
170 return false; 171 return false;
171 } 172 }
172 173
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (!args->GetString(0, &node_path)) 284 if (!args->GetString(0, &node_path))
284 return; 285 return;
285 286
286 CookieTreeOriginNode* origin_node = GetOriginNode( 287 CookieTreeOriginNode* origin_node = GetOriginNode(
287 blocked_cookies_tree_model_.get(), node_path); 288 blocked_cookies_tree_model_.get(), node_path);
288 if (!origin_node) 289 if (!origin_node)
289 return; 290 return;
290 291
291 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); 292 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY);
292 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698