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

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: Keeping up to date with trunk. 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/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
12 #include "chrome/browser/cookies_tree_model.h" 12 #include "chrome/browser/cookies_tree_model.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "chrome/browser/ui/webui/constrained_html_ui.h" 16 #include "chrome/browser/ui/webui/constrained_html_ui.h"
17 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" 17 #include "chrome/browser/ui/webui/cookies_tree_model_util.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/jstemplate_builder.h" 19 #include "chrome/common/jstemplate_builder.h"
20 #include "chrome/common/pref_names.h"
20 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
21 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
22 #include "content/common/notification_service.h" 23 #include "content/common/notification_service.h"
23 #include "grit/browser_resources.h" 24 #include "grit/browser_resources.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/gfx/size.h" 28 #include "ui/gfx/size.h"
28 29
29 namespace { 30 namespace {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile, 138 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile,
138 delegate, 139 delegate,
139 wrapper->tab_contents()); 140 wrapper->tab_contents());
140 } 141 }
141 142
142 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( 143 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate(
143 TabContentsWrapper* wrapper) 144 TabContentsWrapper* wrapper)
144 : wrapper_(wrapper), 145 : wrapper_(wrapper),
145 closed_(false) { 146 closed_(false) {
146 TabSpecificContentSettings* content_settings = wrapper->content_settings(); 147 TabSpecificContentSettings* content_settings = wrapper->content_settings();
147 HostContentSettingsMap* host_content_settings_map = 148 PrefService* prefs = wrapper->profile()->GetPrefs();
148 wrapper->profile()->GetHostContentSettingsMap();
149 149
150 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, 150 registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN,
151 Source<TabSpecificContentSettings>(content_settings)); 151 Source<TabSpecificContentSettings>(content_settings));
152 152
153 allowed_cookies_tree_model_.reset( 153 allowed_cookies_tree_model_.reset(
154 content_settings->GetAllowedCookiesTreeModel()); 154 content_settings->GetAllowedCookiesTreeModel());
155 blocked_cookies_tree_model_.reset( 155 blocked_cookies_tree_model_.reset(
156 content_settings->GetBlockedCookiesTreeModel()); 156 content_settings->GetBlockedCookiesTreeModel());
157 157
158 CollectedCookiesSource* source = new CollectedCookiesSource( 158 CollectedCookiesSource* source = new CollectedCookiesSource(
159 host_content_settings_map->BlockThirdPartyCookies()); 159 prefs->GetBoolean(prefs::kBlockThirdPartyCookies));
160 wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source); 160 wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source);
161 } 161 }
162 162
163 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() { 163 CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() {
164 } 164 }
165 165
166 bool CollectedCookiesUIDelegate::IsDialogModal() const { 166 bool CollectedCookiesUIDelegate::IsDialogModal() const {
167 return false; 167 return false;
168 } 168 }
169 169
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (!args->GetString(0, &node_path)) 279 if (!args->GetString(0, &node_path))
280 return; 280 return;
281 281
282 CookieTreeOriginNode* origin_node = GetOriginNode( 282 CookieTreeOriginNode* origin_node = GetOriginNode(
283 blocked_cookies_tree_model_.get(), node_path); 283 blocked_cookies_tree_model_.get(), node_path);
284 if (!origin_node) 284 if (!origin_node)
285 return; 285 return;
286 286
287 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); 287 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY);
288 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698