| 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/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 7 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 12 #include "chrome/browser/cookies_tree_model.h" | 14 #include "chrome/browser/cookies_tree_model.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 16 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 18 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 const std::string& json_retval) { | 206 const std::string& json_retval) { |
| 205 closed_ = true; | 207 closed_ = true; |
| 206 } | 208 } |
| 207 | 209 |
| 208 bool CollectedCookiesUIDelegate::ShouldShowDialogTitle() const { | 210 bool CollectedCookiesUIDelegate::ShouldShowDialogTitle() const { |
| 209 return true; | 211 return true; |
| 210 } | 212 } |
| 211 | 213 |
| 212 void CollectedCookiesUIDelegate::RegisterMessages() { | 214 void CollectedCookiesUIDelegate::RegisterMessages() { |
| 213 web_ui_->RegisterMessageCallback("BindCookiesTreeModel", | 215 web_ui_->RegisterMessageCallback("BindCookiesTreeModel", |
| 214 NewCallback(this, &CollectedCookiesUIDelegate::BindCookiesTreeModel)); | 216 base::Bind(&CollectedCookiesUIDelegate::BindCookiesTreeModel, |
| 217 base::Unretained(this))); |
| 215 web_ui_->RegisterMessageCallback("Block", | 218 web_ui_->RegisterMessageCallback("Block", |
| 216 NewCallback(this, &CollectedCookiesUIDelegate::Block)); | 219 base::Bind(&CollectedCookiesUIDelegate::Block, |
| 220 base::Unretained(this))); |
| 217 web_ui_->RegisterMessageCallback("Allow", | 221 web_ui_->RegisterMessageCallback("Allow", |
| 218 NewCallback(this, &CollectedCookiesUIDelegate::Allow)); | 222 base::Bind(&CollectedCookiesUIDelegate::Allow, |
| 223 base::Unretained(this))); |
| 219 web_ui_->RegisterMessageCallback("AllowThisSession", | 224 web_ui_->RegisterMessageCallback("AllowThisSession", |
| 220 NewCallback(this, &CollectedCookiesUIDelegate::AllowThisSession)); | 225 base::Bind(&CollectedCookiesUIDelegate::AllowThisSession, |
| 226 base::Unretained(this))); |
| 221 | 227 |
| 222 allowed_cookies_adapter_.Init(web_ui_); | 228 allowed_cookies_adapter_.Init(web_ui_); |
| 223 blocked_cookies_adapter_.Init(web_ui_); | 229 blocked_cookies_adapter_.Init(web_ui_); |
| 224 } | 230 } |
| 225 | 231 |
| 226 void CollectedCookiesUIDelegate::CloseDialog() { | 232 void CollectedCookiesUIDelegate::CloseDialog() { |
| 227 if (!closed_ && web_ui_) | 233 if (!closed_ && web_ui_) |
| 228 web_ui_->CallJavascriptFunction("closeDialog"); | 234 web_ui_->CallJavascriptFunction("closeDialog"); |
| 229 } | 235 } |
| 230 | 236 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (!args->GetString(0, &node_path)) | 295 if (!args->GetString(0, &node_path)) |
| 290 return; | 296 return; |
| 291 | 297 |
| 292 CookieTreeOriginNode* origin_node = GetOriginNode( | 298 CookieTreeOriginNode* origin_node = GetOriginNode( |
| 293 blocked_cookies_tree_model_.get(), node_path); | 299 blocked_cookies_tree_model_.get(), node_path); |
| 294 if (!origin_node) | 300 if (!origin_node) |
| 295 return; | 301 return; |
| 296 | 302 |
| 297 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); | 303 AddContentException(origin_node, CONTENT_SETTING_SESSION_ONLY); |
| 298 } | 304 } |
| OLD | NEW |