| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/net/chrome_cookie_policy.h" | 5 #include "chrome/browser/net/chrome_cookie_policy.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" | 10 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Show the prompt on top of the current tab. | 158 // Show the prompt on top of the current tab. |
| 159 Browser* browser = BrowserList::GetLastActive(); | 159 Browser* browser = BrowserList::GetLastActive(); |
| 160 if (!browser || !browser->GetSelectedTabContents()) { | 160 if (!browser || !browser->GetSelectedTabContents()) { |
| 161 DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false); | 161 DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 | 164 |
| 165 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
| 166 RunCookiePrompt(browser->GetSelectedTabContents(), host, data.cookie_line, | 166 RunCookiePrompt(browser->GetSelectedTabContents(), data.url, data.cookie_line, |
| 167 new PromptDelegate(this, host)); | 167 new PromptDelegate(this, host)); |
| 168 #else | 168 #else |
| 169 // TODO(darin): Enable prompting for other ports. | 169 // TODO(darin): Enable prompting for other ports. |
| 170 DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false); | 170 DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED, false); |
| 171 #endif | 171 #endif |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url, | 174 void ChromeCookiePolicy::PromptForSetCookie(const GURL& url, |
| 175 const std::string& cookie_line) { | 175 const std::string& cookie_line) { |
| 176 if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { | 176 if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 callbacks.push_back(completions[i].callback()); | 234 callbacks.push_back(completions[i].callback()); |
| 235 } | 235 } |
| 236 completions.erase(completions.begin(), completions.begin() + i); | 236 completions.erase(completions.begin(), completions.begin() + i); |
| 237 | 237 |
| 238 if (completions.empty()) | 238 if (completions.empty()) |
| 239 host_completions_map_.erase(it); | 239 host_completions_map_.erase(it); |
| 240 | 240 |
| 241 for (size_t j = 0; j < callbacks.size(); ++j) | 241 for (size_t j = 0; j < callbacks.size(); ++j) |
| 242 callbacks[j]->Run(policy); | 242 callbacks[j]->Run(policy); |
| 243 } | 243 } |
| OLD | NEW |