diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 20:21:04 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 20:21:04 +0000 |
commit | 5d9163e2136f0b4eef4aac3e650f1b6e655118fd (patch) | |
tree | ed86b9c0422989d8c4d90cf628ca9f6239bd5d8b /chrome/browser/net | |
parent | 87c23d51618a288127eed63419e4f26d770f74c5 (diff) | |
download | chromium_src-5d9163e2136f0b4eef4aac3e650f1b6e655118fd.zip chromium_src-5d9163e2136f0b4eef4aac3e650f1b6e655118fd.tar.gz chromium_src-5d9163e2136f0b4eef4aac3e650f1b6e655118fd.tar.bz2 |
Remove vestigial cookie/web app permissions prompting UI now that the async UI has been approved for M7.This allows me to more easily change the way the appmodal dialog system works.
http://crbug.com/55121
TEST=existing tests
Review URL: http://codereview.chromium.org/3299020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/chrome_cookie_policy.cc | 117 | ||||
-rw-r--r-- | chrome/browser/net/chrome_cookie_policy.h | 5 |
2 files changed, 0 insertions, 122 deletions
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc index 52325fd..da700e3 100644 --- a/chrome/browser/net/chrome_cookie_policy.cc +++ b/chrome/browser/net/chrome_cookie_policy.cc @@ -7,9 +7,7 @@ #include "base/string_util.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" #include "chrome/browser/host_content_settings_map.h" -#include "chrome/browser/message_box_handler.h" #include "net/base/net_errors.h" #include "net/base/static_cookie_policy.h" @@ -20,45 +18,6 @@ static const size_t kMaxCompletionsPerHost = 10000; // ---------------------------------------------------------------------------- -// ChromeCookiePolicy cannot just subclass the delegate interface because we -// may have several prompts pending. -class ChromeCookiePolicy::PromptDelegate - : public CookiePromptModalDialogDelegate { - public: - PromptDelegate(ChromeCookiePolicy* cookie_policy, const std::string& host) - : cookie_policy_(cookie_policy), - host_(host) { - } - - // CookiesPromptViewDelegate methods: - virtual void AllowSiteData(bool session_expire); - virtual void BlockSiteData(); - - private: - void NotifyDone(int policy); - - scoped_refptr<ChromeCookiePolicy> cookie_policy_; - std::string host_; -}; - -void ChromeCookiePolicy::PromptDelegate::AllowSiteData(bool session_expire) { - int policy = net::OK; - if (session_expire) - policy = net::OK_FOR_SESSION_ONLY; - NotifyDone(policy); -} - -void ChromeCookiePolicy::PromptDelegate::BlockSiteData() { - NotifyDone(net::ERR_ACCESS_DENIED); -} - -void ChromeCookiePolicy::PromptDelegate::NotifyDone(int policy) { - cookie_policy_->DidPromptForSetCookie(host_, policy); - delete this; -} - -// ---------------------------------------------------------------------------- - ChromeCookiePolicy::ChromeCookiePolicy(HostContentSettingsMap* map) : host_content_settings_map_(map) { } @@ -121,10 +80,7 @@ int ChromeCookiePolicy::CanSetCookie(const GURL& url, DCHECK(callback); - // Else, ask the user... - Completions& completions = host_completions_map_[url.host()]; - if (completions.size() >= kMaxCompletionsPerHost) { LOG(ERROR) << "Would exceed kMaxCompletionsPerHost"; policy = net::ERR_ACCESS_DENIED; @@ -133,7 +89,6 @@ int ChromeCookiePolicy::CanSetCookie(const GURL& url, policy = net::ERR_IO_PENDING; } - PromptForSetCookie(url, cookie_line); return policy; } @@ -149,75 +104,3 @@ int ChromeCookiePolicy::CheckPolicy(const GURL& url) const { return net::ERR_IO_PENDING; // Need to prompt. } -void ChromeCookiePolicy::PromptForSetCookie(const GURL& url, - const std::string& cookie_line) { - if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { - ChromeThread::PostTask( - ChromeThread::UI, FROM_HERE, - NewRunnableMethod(this, &ChromeCookiePolicy::PromptForSetCookie, url, - cookie_line)); - return; - } - - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - const std::string& host = url.host(); - - // The policy may have changed (due to the "remember" option) - int policy = CheckPolicy(url); - if (policy != net::ERR_IO_PENDING) { - DidPromptForSetCookie(host, policy); - return; - } - - // Show the prompt on top of the current tab. - Browser* browser = BrowserList::GetLastActive(); - if (!browser || !browser->GetSelectedTabContents()) { - DidPromptForSetCookie(host, net::ERR_ACCESS_DENIED); - return; - } - - RunCookiePrompt(browser->GetSelectedTabContents(), - host_content_settings_map_, url, cookie_line, - new PromptDelegate(this, host)); -} - -void ChromeCookiePolicy::DidPromptForSetCookie(const std::string& host, - int policy) { - if (!ChromeThread::CurrentlyOn(ChromeThread::IO)) { - ChromeThread::PostTask( - ChromeThread::IO, FROM_HERE, - NewRunnableMethod(this, &ChromeCookiePolicy::DidPromptForSetCookie, - host, policy)); - return; - } - - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - - // Notify all callbacks, starting with the first until we hit another that - // is for a 'set-cookie'. - HostCompletionsMap::iterator it = host_completions_map_.find(host); - CHECK(it != host_completions_map_.end()); - - Completions& completions = it->second; - CHECK(!completions.empty() && completions[0].is_set_cookie_request()); - - // Gather the list of callbacks to notify, and remove them from the - // completions list before handing control to the callbacks (in case - // they should call back into us to modify host_completions_map_). - - std::vector<net::CompletionCallback*> callbacks; - callbacks.push_back(completions[0].callback()); - size_t i = 1; - for (; i < completions.size(); ++i) { - if (completions[i].is_set_cookie_request()) - break; - callbacks.push_back(completions[i].callback()); - } - completions.erase(completions.begin(), completions.begin() + i); - - if (completions.empty()) - host_completions_map_.erase(it); - - for (size_t j = 0; j < callbacks.size(); ++j) - callbacks[j]->Run(policy); -} diff --git a/chrome/browser/net/chrome_cookie_policy.h b/chrome/browser/net/chrome_cookie_policy.h index 8265437..ea63e6b 100644 --- a/chrome/browser/net/chrome_cookie_policy.h +++ b/chrome/browser/net/chrome_cookie_policy.h @@ -38,9 +38,6 @@ class ChromeCookiePolicy net::CompletionCallback* callback); private: - class PromptDelegate; - friend class PromptDelegate; - class Completion { public: static Completion ForSetCookie(net::CompletionCallback* callback) { @@ -67,8 +64,6 @@ class ChromeCookiePolicy typedef std::map<std::string, Completions> HostCompletionsMap; int CheckPolicy(const GURL& url) const; - void PromptForSetCookie(const GURL& url, const std::string& cookie_line); - void DidPromptForSetCookie(const std::string& host, int result); // A map from hostname to callbacks awaiting a cookie policy response. // This map is only accessed on the IO thread. |