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/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" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( | 144 CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( |
145 TabContents* tab_contents) | 145 TabContents* tab_contents) |
146 : tab_contents_(tab_contents), | 146 : tab_contents_(tab_contents), |
147 closed_(false) { | 147 closed_(false) { |
148 TabSpecificContentSettings* content_settings = | 148 TabSpecificContentSettings* content_settings = |
149 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> | 149 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> |
150 content_settings(); | 150 content_settings(); |
151 HostContentSettingsMap* host_content_settings_map = | 151 HostContentSettingsMap* host_content_settings_map = |
152 tab_contents_->profile()->GetHostContentSettingsMap(); | 152 tab_contents_->profile()->GetHostContentSettingsMap(); |
153 | 153 |
154 registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, | 154 registrar_.Add(this, chrome::COLLECTED_COOKIES_SHOWN, |
155 Source<TabSpecificContentSettings>(content_settings)); | 155 Source<TabSpecificContentSettings>(content_settings)); |
156 | 156 |
157 allowed_cookies_tree_model_.reset( | 157 allowed_cookies_tree_model_.reset( |
158 content_settings->GetAllowedCookiesTreeModel()); | 158 content_settings->GetAllowedCookiesTreeModel()); |
159 blocked_cookies_tree_model_.reset( | 159 blocked_cookies_tree_model_.reset( |
160 content_settings->GetBlockedCookiesTreeModel()); | 160 content_settings->GetBlockedCookiesTreeModel()); |
161 | 161 |
162 CollectedCookiesSource* source = new CollectedCookiesSource( | 162 CollectedCookiesSource* source = new CollectedCookiesSource( |
163 host_content_settings_map->BlockThirdPartyCookies()); | 163 host_content_settings_map->BlockThirdPartyCookies()); |
164 tab_contents->profile()->GetChromeURLDataManager()->AddDataSource(source); | 164 tab_contents->profile()->GetChromeURLDataManager()->AddDataSource(source); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void CollectedCookiesUIDelegate::AddContentException( | 230 void CollectedCookiesUIDelegate::AddContentException( |
231 CookieTreeOriginNode* origin_node, ContentSetting setting) { | 231 CookieTreeOriginNode* origin_node, ContentSetting setting) { |
232 if (origin_node->CanCreateContentException()) { | 232 if (origin_node->CanCreateContentException()) { |
233 origin_node->CreateContentException( | 233 origin_node->CreateContentException( |
234 tab_contents_->profile()->GetHostContentSettingsMap(), setting); | 234 tab_contents_->profile()->GetHostContentSettingsMap(), setting); |
235 | 235 |
236 SetInfobarLabel(GetInfobarLabel(setting, origin_node->GetTitle())); | 236 SetInfobarLabel(GetInfobarLabel(setting, origin_node->GetTitle())); |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 void CollectedCookiesUIDelegate::Observe(NotificationType type, | 240 void CollectedCookiesUIDelegate::Observe(int type, |
241 const NotificationSource& source, | 241 const NotificationSource& source, |
242 const NotificationDetails& details) { | 242 const NotificationDetails& details) { |
243 DCHECK_EQ(type.value, NotificationType::COLLECTED_COOKIES_SHOWN); | 243 DCHECK_EQ(type, chrome::COLLECTED_COOKIES_SHOWN); |
244 CloseDialog(); | 244 CloseDialog(); |
245 } | 245 } |
246 | 246 |
247 void CollectedCookiesUIDelegate::BindCookiesTreeModel(const ListValue* args) { | 247 void CollectedCookiesUIDelegate::BindCookiesTreeModel(const ListValue* args) { |
248 allowed_cookies_adapter_.Bind("allowed-cookies", | 248 allowed_cookies_adapter_.Bind("allowed-cookies", |
249 allowed_cookies_tree_model_.get()); | 249 allowed_cookies_tree_model_.get()); |
250 blocked_cookies_adapter_.Bind("blocked-cookies", | 250 blocked_cookies_adapter_.Bind("blocked-cookies", |
251 blocked_cookies_tree_model_.get()); | 251 blocked_cookies_tree_model_.get()); |
252 } | 252 } |
253 | 253 |
(...skipping 28 matching lines...) Expand all Loading... |
282 if (!args->GetString(0, &node_path)) | 282 if (!args->GetString(0, &node_path)) |
283 return; | 283 return; |
284 | 284 |
285 CookieTreeOriginNode* origin_node = GetOriginNode( | 285 CookieTreeOriginNode* origin_node = GetOriginNode( |
286 blocked_cookies_tree_model_.get(), node_path); | 286 blocked_cookies_tree_model_.get(), node_path); |
287 if (!origin_node) | 287 if (!origin_node) |
288 return; | 288 return; |
289 | 289 |
290 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); | 290 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); |
291 } | 291 } |
OLD | NEW |