summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 13:28:11 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 13:28:11 +0000
commit5f450e5c6fc98a762cebb38cd080731bedd61ae3 (patch)
treede1e6a257709c220222a6ab9defac23aade6e45c /chrome/browser
parent60147f3b071444f0abfb320e62a0c9f2b666d443 (diff)
downloadchromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.zip
chromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.tar.gz
chromium_src-5f450e5c6fc98a762cebb38cd080731bedd61ae3.tar.bz2
Navigation and cookies for Automation
Give Automation better visibility and control over navigations. Also, make it possible for automation to implement a dummy cookie store to go with dummy request serving over automation. BUG=none TEST=none Review URL: http://codereview.chromium.org/159189 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/automation_profile_impl.cc114
-rw-r--r--chrome/browser/automation/automation_profile_impl.h198
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc28
-rw-r--r--chrome/browser/browsing_data_remover.cc5
-rw-r--r--chrome/browser/cookies_table_model.cc5
-rw-r--r--chrome/browser/external_tab_container.cc23
-rw-r--r--chrome/browser/external_tab_container.h7
-rw-r--r--chrome/browser/importer/toolbar_importer.cc4
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc19
-rw-r--r--chrome/browser/net/chrome_url_request_context.h4
-rw-r--r--chrome/browser/plugin_process_host.cc1
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc1
13 files changed, 390 insertions, 23 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc
new file mode 100644
index 0000000..51923ae
--- /dev/null
+++ b/chrome/browser/automation/automation_profile_impl.cc
@@ -0,0 +1,114 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/automation/automation_profile_impl.h"
+#include "chrome/test/automation/automation_messages.h"
+#include "net/url_request/url_request_context.h"
+
+// A special Request context for automation. Substitute a few things
+// like cookie store, proxy settings etc to handle them differently
+// for automation.
+class AutomationURLRequestContext : public URLRequestContext {
+ public:
+ AutomationURLRequestContext(URLRequestContext* original_context,
+ net::CookieStore* automation_cookie_store) {
+ host_resolver_ = original_context->host_resolver();
+ proxy_service_ = original_context->proxy_service();
+ http_transaction_factory_ = original_context->http_transaction_factory();
+ ftp_transaction_factory_ = original_context->ftp_transaction_factory();
+ cookie_store_ = automation_cookie_store;
+ cookie_policy_.set_type(original_context->cookie_policy()->type());
+ force_tls_state_ = original_context->force_tls_state();
+ // ftp_auth_cache_ = original_context->ftp_auth_cache();
+ blacklist_ = original_context->blacklist();
+ accept_language_ = original_context->accept_language();
+ accept_charset_ = original_context->accept_charset();
+ referrer_charset_ = original_context->referrer_charset();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AutomationURLRequestContext);
+};
+
+// CookieStore specialization to have automation specific
+// behavior for cookies.
+class AutomationCookieStore : public net::CookieStore {
+ public:
+ AutomationCookieStore(AutomationProfileImpl* profile,
+ net::CookieStore* original_cookie_store,
+ IPC::Message::Sender* automation_client)
+ : profile_(profile),
+ original_cookie_store_(original_cookie_store),
+ automation_client_(automation_client) {
+ }
+
+ // CookieStore implementation.
+ virtual bool SetCookie(const GURL& url, const std::string& cookie_line) {
+ bool cookie_set = original_cookie_store_->SetCookie(url, cookie_line);
+ if (cookie_set) {
+ automation_client_->Send(new AutomationMsg_SetCookieAsync(0,
+ profile_->tab_handle(), url, cookie_line));
+ }
+ return cookie_set;
+ }
+ virtual bool SetCookieWithOptions(const GURL& url,
+ const std::string& cookie_line,
+ const net::CookieOptions& options) {
+ return original_cookie_store_->SetCookieWithOptions(url, cookie_line,
+ options);
+ }
+ virtual bool SetCookieWithCreationTime(const GURL& url,
+ const std::string& cookie_line,
+ const base::Time& creation_time) {
+ return original_cookie_store_->SetCookieWithCreationTime(url, cookie_line,
+ creation_time);
+ }
+ virtual bool SetCookieWithCreationTimeWithOptions(
+ const GURL& url,
+ const std::string& cookie_line,
+ const base::Time& creation_time,
+ const net::CookieOptions& options) {
+ return original_cookie_store_->SetCookieWithCreationTimeWithOptions(url,
+ cookie_line, creation_time, options);
+ }
+ virtual void SetCookies(const GURL& url,
+ const std::vector<std::string>& cookies) {
+ original_cookie_store_->SetCookies(url, cookies);
+ }
+ virtual void SetCookiesWithOptions(const GURL& url,
+ const std::vector<std::string>& cookies,
+ const net::CookieOptions& options) {
+ original_cookie_store_->SetCookiesWithOptions(url, cookies, options);
+ }
+ virtual std::string GetCookies(const GURL& url) {
+ return original_cookie_store_->GetCookies(url);
+ }
+ virtual std::string GetCookiesWithOptions(const GURL& url,
+ const net::CookieOptions& options) {
+ return original_cookie_store_->GetCookiesWithOptions(url, options);
+ }
+
+ protected:
+ AutomationProfileImpl* profile_;
+ net::CookieStore* original_cookie_store_;
+ IPC::Message::Sender* automation_client_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AutomationCookieStore);
+};
+
+void AutomationProfileImpl::Initialize(Profile* original_profile,
+ IPC::Message::Sender* automation_client) {
+ DCHECK(original_profile);
+ original_profile_ = original_profile;
+
+ URLRequestContext* original_context = original_profile_->GetRequestContext();
+ net::CookieStore* original_cookie_store = original_context->cookie_store();
+ alternate_cookie_store_.reset(new AutomationCookieStore(this,
+ original_cookie_store,
+ automation_client));
+ alternate_reqeust_context_ = new AutomationURLRequestContext(
+ original_context, alternate_cookie_store_.get());
+}
+
diff --git a/chrome/browser/automation/automation_profile_impl.h b/chrome/browser/automation/automation_profile_impl.h
new file mode 100644
index 0000000..2a9b133
--- /dev/null
+++ b/chrome/browser/automation/automation_profile_impl.h
@@ -0,0 +1,198 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_
+#define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_
+
+#include "chrome/browser/profile.h"
+#include "net/url_request/url_request_context.h"
+
+namespace net {
+class CookieStore;
+}
+
+// Automation overrides for profile settings.
+class AutomationProfileImpl : public Profile {
+ public:
+ AutomationProfileImpl() : original_profile_(NULL) {
+ }
+
+ void Initialize(Profile* original_profile,
+ IPC::Message::Sender* automation_client);
+
+ void set_tab_handle(int tab_handle) {
+ tab_handle_ = tab_handle;
+ }
+ int tab_handle() const {
+ return tab_handle_;
+ }
+
+ // Profile implementation.
+ virtual FilePath GetPath() {
+ return original_profile_->GetPath();
+ }
+ virtual bool IsOffTheRecord() {
+ return original_profile_->IsOffTheRecord();
+ }
+ virtual Profile* GetOffTheRecordProfile() {
+ return original_profile_->GetOffTheRecordProfile();
+ }
+ virtual void DestroyOffTheRecordProfile() {
+ return original_profile_->DestroyOffTheRecordProfile();
+ }
+ virtual Profile* GetOriginalProfile() {
+ return original_profile_->GetOriginalProfile();
+ }
+ virtual VisitedLinkMaster* GetVisitedLinkMaster() {
+ return original_profile_->GetVisitedLinkMaster();
+ }
+ virtual ExtensionsService* GetExtensionsService() {
+ return original_profile_->GetExtensionsService();
+ }
+ virtual UserScriptMaster* GetUserScriptMaster() {
+ return original_profile_->GetUserScriptMaster();
+ }
+ virtual ExtensionProcessManager* GetExtensionProcessManager() {
+ return original_profile_->GetExtensionProcessManager();
+ }
+ virtual ExtensionMessageService* GetExtensionMessageService() {
+ return original_profile_->GetExtensionMessageService();
+ }
+ virtual SSLHostState* GetSSLHostState() {
+ return original_profile_->GetSSLHostState();
+ }
+ virtual net::ForceTLSState* GetForceTLSState() {
+ return original_profile_->GetForceTLSState();
+ }
+ virtual HistoryService* GetHistoryService(ServiceAccessType access) {
+ return original_profile_->GetHistoryService(access);
+ }
+ virtual WebDataService* GetWebDataService(ServiceAccessType access) {
+ return original_profile_->GetWebDataService(access);
+ }
+ virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
+ return original_profile_->GetPasswordStore(access);
+ }
+ virtual PrefService* GetPrefs() {
+ return original_profile_->GetPrefs();
+ }
+ virtual TemplateURLModel* GetTemplateURLModel() {
+ return original_profile_->GetTemplateURLModel();
+ }
+ virtual TemplateURLFetcher* GetTemplateURLFetcher() {
+ return original_profile_->GetTemplateURLFetcher();
+ }
+ virtual DownloadManager* GetDownloadManager() {
+ return original_profile_->GetDownloadManager();
+ }
+ virtual bool HasCreatedDownloadManager() const {
+ return original_profile_->HasCreatedDownloadManager();
+ }
+ virtual void InitThemes() {
+ return original_profile_->InitThemes();
+ }
+ virtual void SetTheme(Extension* extension) {
+ return original_profile_->SetTheme(extension);
+ }
+ virtual void SetNativeTheme() {
+ return original_profile_->SetNativeTheme();
+ }
+ virtual void ClearTheme() {
+ return original_profile_->ClearTheme();
+ }
+ virtual ThemeProvider* GetThemeProvider() {
+ return original_profile_->GetThemeProvider();
+ }
+ virtual ThumbnailStore* GetThumbnailStore() {
+ return original_profile_->GetThumbnailStore();
+ }
+ virtual URLRequestContext* GetRequestContext() {
+ return alternate_reqeust_context_;
+ }
+ virtual URLRequestContext* GetRequestContextForMedia() {
+ return original_profile_->GetRequestContextForMedia();
+ }
+ virtual URLRequestContext* GetRequestContextForExtensions() {
+ return original_profile_->GetRequestContextForExtensions();
+ }
+ virtual Blacklist* GetBlacklist() {
+ return original_profile_->GetBlacklist();
+ }
+ virtual SessionService* GetSessionService() {
+ return original_profile_->GetSessionService();
+ }
+ virtual void ShutdownSessionService() {
+ return original_profile_->ShutdownSessionService();
+ }
+ virtual bool HasSessionService() const {
+ return original_profile_->HasSessionService();
+ }
+ virtual std::wstring GetName() {
+ return original_profile_->GetName();
+ }
+ virtual void SetName(const std::wstring& name) {
+ return original_profile_->SetName(name);
+ }
+ virtual std::wstring GetID() {
+ return original_profile_->GetID();
+ }
+ virtual void SetID(const std::wstring& id) {
+ return original_profile_->SetID(id);
+ }
+ virtual bool DidLastSessionExitCleanly() {
+ return original_profile_->DidLastSessionExitCleanly();
+ }
+ virtual BookmarkModel* GetBookmarkModel() {
+ return original_profile_->GetBookmarkModel();
+ }
+
+#ifdef CHROME_PERSONALIZATION
+ virtual ProfilePersonalization* GetProfilePersonalization() {
+ return original_profile_->GetProfilePersonalization();
+ }
+#endif
+
+ virtual bool IsSameProfile(Profile* profile) {
+ return original_profile_->IsSameProfile(profile);
+ }
+ virtual base::Time GetStartTime() const {
+ return original_profile_->GetStartTime();
+ }
+ virtual TabRestoreService* GetTabRestoreService() {
+ return original_profile_->GetTabRestoreService();
+ }
+ virtual void ResetTabRestoreService() {
+ return original_profile_->ResetTabRestoreService();
+ }
+ virtual void ReinitializeSpellChecker() {
+ return original_profile_->ReinitializeSpellChecker();
+ }
+ virtual SpellChecker* GetSpellChecker() {
+ return original_profile_->GetSpellChecker();
+ }
+ virtual WebKitContext* GetWebKitContext() {
+ return original_profile_->GetWebKitContext();
+ }
+ virtual void MarkAsCleanShutdown() {
+ return original_profile_->MarkAsCleanShutdown();
+ }
+ virtual void InitExtensions() {
+ return original_profile_->InitExtensions();
+ }
+ virtual void InitWebResources() {
+ return original_profile_->InitWebResources();
+ }
+
+ protected:
+ Profile* original_profile_;
+ scoped_ptr<net::CookieStore> alternate_cookie_store_;
+ scoped_refptr<URLRequestContext> alternate_reqeust_context_;
+ int tab_handle_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AutomationProfileImpl);
+};
+
+#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_
+
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 2f74d23..4bb2d65 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -50,7 +50,6 @@
#include "chrome/common/platform_util.h"
#include "chrome/common/pref_service.h"
#include "chrome/test/automation/automation_messages.h"
-#include "net/base/cookie_monster.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/url_request/url_request_context.h"
@@ -2396,7 +2395,8 @@ void AutomationProvider::CreateExternalTab(
Profile* profile = settings.is_off_the_record ?
profile_->GetOffTheRecordProfile() : profile_;
external_tab_container->Init(profile, settings.parent, settings.dimensions,
- settings.style, settings.load_requests_via_automation);
+ settings.style, settings.load_requests_via_automation,
+ settings.handle_top_level_requests);
TabContents* tab_contents = external_tab_container->tab_contents();
if (tab_contents) {
*tab_handle = tab_tracker_->Add(&tab_contents->controller());
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 6ab7f87..5d4cac6 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -12,6 +12,7 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
// This class manages the interception of network requests for automation.
@@ -191,9 +192,34 @@ void URLRequestAutomationJob::OnRequestStarted(
set_expected_content_size(response.content_length);
mime_type_ = response.mime_type;
- if (!response.headers.empty())
+ if (!response.headers.empty()) {
headers_ = new net::HttpResponseHeaders(response.headers);
+ // Parse and set HTTP cookies.
+ const std::string name = "Set-Cookie";
+ std::string value;
+ std::vector<std::string> response_cookies;
+
+ void* iter = NULL;
+ while (headers_->EnumerateHeader(&iter, name, &value)) {
+ if (request_->context()->InterceptCookie(request_, &value))
+ response_cookies.push_back(value);
+ }
+
+ if (response_cookies.size()) {
+ URLRequestContext* ctx = request_->context();
+ if (ctx && ctx->cookie_store() &&
+ ctx->cookie_policy()->CanSetCookie(
+ request_->url(), request_->first_party_for_cookies())) {
+ net::CookieOptions options;
+ options.set_include_httponly();
+ ctx->cookie_store()->SetCookiesWithOptions(request_->url(),
+ response_cookies,
+ options);
+ }
+ }
+ }
+
NotifyHeadersComplete();
}
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index abc97ef..96e1543 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -110,8 +110,9 @@ void BrowsingDataRemover::Remove(int remove_mask) {
if (remove_mask & REMOVE_COOKIES) {
UserMetrics::RecordAction(L"ClearBrowsingData_Cookies", profile_);
net::CookieMonster* cookie_monster =
- profile_->GetRequestContext()->cookie_store();
- cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true);
+ profile_->GetRequestContext()->cookie_store()->GetCookieMonster();
+ if (cookie_monster)
+ cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true);
}
if (remove_mask & REMOVE_PASSWORDS) {
diff --git a/chrome/browser/cookies_table_model.cc b/chrome/browser/cookies_table_model.cc
index 8aab8e2..3f85819 100644
--- a/chrome/browser/cookies_table_model.cc
+++ b/chrome/browser/cookies_table_model.cc
@@ -39,7 +39,8 @@ void CookiesTableModel::RemoveCookies(int start_index, int remove_count) {
return;
}
- net::CookieMonster* monster = profile_->GetRequestContext()->cookie_store();
+ net::CookieMonster* monster =
+ profile_->GetRequestContext()->cookie_store()->GetCookieMonster();
// We need to update the searched results list, the full cookie list,
// and the view. We walk through the search results list (which is what
@@ -158,7 +159,7 @@ static bool ContainsFilterText(
void CookiesTableModel::LoadCookies() {
// mmargh mmargh mmargh!
net::CookieMonster* cookie_monster =
- profile_->GetRequestContext()->cookie_store();
+ profile_->GetRequestContext()->cookie_store()->GetCookieMonster();
all_cookies_ = cookie_monster->GetAllCookies();
DoFilter();
}
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index ab74af1..ee4eb85 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -46,7 +46,8 @@ bool ExternalTabContainer::Init(Profile* profile,
HWND parent,
const gfx::Rect& bounds,
DWORD style,
- bool load_requests_via_automation) {
+ bool load_requests_via_automation,
+ bool handle_top_level_requests) {
if (IsWindow()) {
NOTREACHED();
return false;
@@ -66,8 +67,25 @@ bool ExternalTabContainer::Init(Profile* profile,
// is the same as the lifetime of the window
SetProp(GetNativeView(), kWindowObjectKey, this);
+ // If we are sending top level requests through the automation then
+ // we should be using automation to load url requests as well.
+ DCHECK(handle_top_level_requests ? load_requests_via_automation : 1);
+
+ if (load_requests_via_automation) {
+ // Customize our profile.
+ // TODO(joshia): If we are loading requests via automation
+ // and handling cookies in automation then it's probably better to
+ // use OTR profile so that cookies are not persisted in chrome.
+ automation_profile_.reset(new AutomationProfileImpl);
+ automation_profile_->Initialize(profile,
+ automation_resource_message_filter_);
+ profile = automation_profile_.get();
+ }
+
tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL);
tab_contents_->set_delegate(this);
+ tab_contents_->GetMutableRendererPrefs()->browser_handles_top_level_requests =
+ handle_top_level_requests;
tab_contents_->render_view_host()->AllowBindings(
BindingsPolicy::EXTERNAL_HOST);
@@ -163,13 +181,16 @@ void ExternalTabContainer::OpenURLFromTab(TabContents* source,
case SINGLETON_TAB:
case NEW_FOREGROUND_TAB:
case NEW_BACKGROUND_TAB:
+ case NEW_POPUP:
case NEW_WINDOW:
+ case SAVE_TO_DISK:
if (automation_) {
automation_->Send(new AutomationMsg_OpenURL(0, tab_handle_,
url, disposition));
}
break;
default:
+ NOTREACHED();
break;
}
}
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index f698c9e..0c19ebf 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -8,6 +8,7 @@
#include <vector>
#include "chrome/browser/automation/automation_resource_message_filter.h"
+#include "chrome/browser/automation/automation_profile_impl.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/notification_observer.h"
@@ -41,7 +42,8 @@ class ExternalTabContainer : public TabContentsDelegate,
HWND parent,
const gfx::Rect& bounds,
DWORD style,
- bool load_requests_via_automation);
+ bool load_requests_via_automation,
+ bool handle_top_level_requests);
// This is invoked when the external host reflects back to us a keyboard
// message it did not process
@@ -157,6 +159,9 @@ class ExternalTabContainer : public TabContentsDelegate,
// Scoped browser object for this ExternalTabContainer instance.
scoped_ptr<Browser> browser_;
+ // A customized profile for automation specific needs.
+ scoped_ptr<AutomationProfileImpl> automation_profile_;
+
DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer);
};
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index 83fb29f..20e10da 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -25,9 +25,9 @@ static const char* kGoogleDomainSecureCookieId = "SID=";
bool toolbar_importer_utils::IsGoogleGAIACookieInstalled() {
URLRequestContext* context = Profile::GetDefaultRequestContext();
- net::CookieMonster* store = context->cookie_store();
+ net::CookieStore* store = context->cookie_store();
GURL url(kGoogleDomainUrl);
- net::CookieMonster::CookieOptions options;
+ net::CookieOptions options;
options.set_include_httponly(); // The SID cookie might be httponly.
std::string cookies = store->GetCookiesWithOptions(url, options);
std::vector<std::string> cookie_list;
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 8e407f7..7130b45 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -178,11 +178,13 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForExtensions(
context->cookie_db_.reset(new SQLitePersistentCookieStore(
cookie_store_path.ToWStringHack(),
g_browser_process->db_thread()->message_loop()));
- context->cookie_store_ = new net::CookieMonster(context->cookie_db_.get());
+ net::CookieMonster* cookie_monster = new net::CookieMonster(
+ context->cookie_db_.get());
// Enable cookies for extension URLs only.
const char* schemes[] = {chrome::kExtensionScheme};
- context->cookie_store_->SetCookieableSchemes(schemes, 1);
+ cookie_monster->SetCookieableSchemes(schemes, 1);
+ context->cookie_store_ = cookie_monster;
return context;
}
@@ -213,11 +215,12 @@ ChromeURLRequestContext*
ChromeURLRequestContext::CreateOffTheRecordForExtensions(Profile* profile) {
DCHECK(profile->IsOffTheRecord());
ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
- context->cookie_store_ = new net::CookieMonster;
+ net::CookieMonster* cookie_monster = new net::CookieMonster;
// Enable cookies for extension URLs only.
const char* schemes[] = {chrome::kExtensionScheme};
- context->cookie_store_->SetCookieableSchemes(schemes, 1);
+ cookie_monster->SetCookieableSchemes(schemes, 1);
+ context->cookie_store_ = cookie_monster;
return context;
}
@@ -290,7 +293,7 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
// net_util::GetSuggestedFilename is unlikely to be taken.
referrer_charset_ = default_charset;
- cookie_policy_.SetType(net::CookiePolicy::FromInt(
+ cookie_policy_.set_type(net::CookiePolicy::FromInt(
prefs_->GetInteger(prefs::kCookieBehavior)));
blacklist_ = profile->GetBlacklist();
@@ -397,7 +400,7 @@ const std::string& ChromeURLRequestContext::GetUserAgent(
return webkit_glue::GetUserAgent(url);
}
-bool ChromeURLRequestContext::interceptCookie(const URLRequest* request,
+bool ChromeURLRequestContext::InterceptCookie(const URLRequest* request,
std::string* cookie) {
const URLRequest::UserData* d =
request->GetUserData(&Blacklist::kRequestDataKey);
@@ -414,7 +417,7 @@ bool ChromeURLRequestContext::interceptCookie(const URLRequest* request,
return true;
}
-bool ChromeURLRequestContext::allowSendingCookies(const URLRequest* request)
+bool ChromeURLRequestContext::AllowSendingCookies(const URLRequest* request)
const {
const URLRequest::UserData* d =
request->GetUserData(&Blacklist::kRequestDataKey);
@@ -438,7 +441,7 @@ void ChromeURLRequestContext::OnCookiePolicyChange(
net::CookiePolicy::Type type) {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
- cookie_policy_.SetType(type);
+ cookie_policy_.set_type(type);
}
void ChromeURLRequestContext::OnDefaultCharsetChange(
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index fba8395..9dc0393 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -65,9 +65,9 @@ class ChromeURLRequestContext : public URLRequestContext,
virtual const std::string& GetUserAgent(const GURL& url) const;
- virtual bool interceptCookie(const URLRequest* request, std::string* cookie);
+ virtual bool InterceptCookie(const URLRequest* request, std::string* cookie);
- virtual bool allowSendingCookies(const URLRequest* request) const;
+ virtual bool AllowSendingCookies(const URLRequest* request) const;
private:
// Private constructor, use the static factory methods instead. This is
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index ca2f502..d57daae 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -44,7 +44,6 @@
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_descriptors.h"
#include "ipc/ipc_switches.h"
-#include "net/base/cookie_monster.h"
#include "net/base/file_stream.h"
#include "net/base/io_buffer.h"
#include "net/url_request/url_request.h"
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index e1a37a1..5cb59a1 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -36,7 +36,6 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
-#include "net/base/cookie_monster.h"
#include "net/base/mime_util.h"
#include "net/base/load_flags.h"
#include "net/http/http_cache.h"