summaryrefslogtreecommitdiffstats
path: root/content/browser/net/sqlite_persistent_cookie_store.cc
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-03 19:55:42 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-03 19:55:42 +0000
commit07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed (patch)
tree81f10d61210a6dac7f684d9aeced876dcdc0beac /content/browser/net/sqlite_persistent_cookie_store.cc
parent6dbbaa2bd49d9796faccb96f0d19424705f37048 (diff)
downloadchromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.zip
chromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.tar.gz
chromium_src-07aaae69b6a8ea45f8e38973ea51697f2aa1c1ed.tar.bz2
Make CookieMonster::Delegate top-level and remove global CookieMonster::EnableFileScheme().
Relanding parts of https://chromiumcodereview.appspot.com/12546016 R=rsleevi@chromium.org TBR=jam BUG=159193,331424 Review URL: https://codereview.chromium.org/93593005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/net/sqlite_persistent_cookie_store.cc')
-rw-r--r--content/browser/net/sqlite_persistent_cookie_store.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/content/browser/net/sqlite_persistent_cookie_store.cc b/content/browser/net/sqlite_persistent_cookie_store.cc
index e2b7880..c8bec83 100644
--- a/content/browser/net/sqlite_persistent_cookie_store.cc
+++ b/content/browser/net/sqlite_persistent_cookie_store.cc
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/location.h"
@@ -28,6 +29,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_crypto_delegate.h"
#include "content/public/browser/cookie_store_factory.h"
+#include "content/public/common/content_switches.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
@@ -1264,7 +1266,25 @@ net::CookieStore* CreatePersistentCookieStore(
restore_old_session_cookies,
storage_policy,
crypto_delegate.Pass());
- return new net::CookieMonster(persistent_store, cookie_monster_delegate);
+
+ net::CookieMonster* cookie_monster =
+ new net::CookieMonster(persistent_store, cookie_monster_delegate);
+
+ // In the case of Android WebView, the cookie store may be created
+ // before the browser process fully initializes -- certainly before
+ // the main loop ever runs. In this situation, the CommandLine singleton
+ // will not have been set up. Android tests do not need file cookies
+ // so always ignore them here.
+ //
+ // TODO(ajwong): Remove the InitializedForCurrentProcess() check
+ // once http://crbug.com/331424 is resolved.
+ if (CommandLine::InitializedForCurrentProcess() &&
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableFileCookies)) {
+ cookie_monster->SetEnableFileScheme(true);
+ }
+
+ return cookie_monster;
}
net::CookieStore* CreatePersistentCookieStore(