Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: trunk/src/net/cookies/cookie_monster.cc

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/net/cookies/cookie_monster.h ('k') | trunk/src/net/cookies/cookie_monster_store_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/net/cookies/cookie_monster.cc
===================================================================
--- trunk/src/net/cookies/cookie_monster.cc (revision 219785)
+++ trunk/src/net/cookies/cookie_monster.cc (working copy)
@@ -256,38 +256,38 @@
LowerBoundAccessDateComparator);
}
-// Mapping between DeletionCause and CookieMonsterDelegate::ChangeCause; the
-// mapping also provides a boolean that specifies whether or not an
-// OnCookieChanged notification ought to be generated.
+// Mapping between DeletionCause and Delegate::ChangeCause; the mapping also
+// provides a boolean that specifies whether or not an OnCookieChanged
+// notification ought to be generated.
typedef struct ChangeCausePair_struct {
- CookieMonsterDelegate::ChangeCause cause;
+ CookieMonster::Delegate::ChangeCause cause;
bool notify;
} ChangeCausePair;
ChangeCausePair ChangeCauseMapping[] = {
// DELETE_COOKIE_EXPLICIT
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT, true },
// DELETE_COOKIE_OVERWRITE
- { CookieMonsterDelegate::CHANGE_COOKIE_OVERWRITE, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_OVERWRITE, true },
// DELETE_COOKIE_EXPIRED
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPIRED, true },
// DELETE_COOKIE_EVICTED
- { CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_DUPLICATE_IN_BACKING_STORE
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT, false },
// DELETE_COOKIE_DONT_RECORD
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT, false },
// DELETE_COOKIE_EVICTED_DOMAIN
- { CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_EVICTED_GLOBAL
- { CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_EVICTED_DOMAIN_PRE_SAFE
- { CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE
- { CookieMonsterDelegate::CHANGE_COOKIE_EVICTED, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_EXPIRED_OVERWRITE
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPIRED_OVERWRITE, true },
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPIRED_OVERWRITE, true },
// DELETE_COOKIE_LAST_ENTRY
- { CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT, false }
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT, false }
};
std::string BuildCookieLine(const CanonicalCookieVector& cookies) {
@@ -308,8 +308,10 @@
} // namespace
-CookieMonster::CookieMonster(PersistentCookieStore* store,
- CookieMonsterDelegate* delegate)
+// static
+bool CookieMonster::default_enable_file_scheme_ = false;
+
+CookieMonster::CookieMonster(PersistentCookieStore* store, Delegate* delegate)
: initialized_(false),
loaded_(false),
store_(store),
@@ -325,7 +327,7 @@
}
CookieMonster::CookieMonster(PersistentCookieStore* store,
- CookieMonsterDelegate* delegate,
+ Delegate* delegate,
int last_access_threshold_milliseconds)
: initialized_(false),
loaded_(false),
@@ -1277,6 +1279,11 @@
keep_expired_cookies_ = true;
}
+// static
+void CookieMonster::EnableFileScheme() {
+ default_enable_file_scheme_ = true;
+}
+
void CookieMonster::FlushStore(const base::Closure& callback) {
base::AutoLock autolock(lock_);
if (initialized_ && store_.get())
@@ -1635,9 +1642,9 @@
arraysize(CookieMonster::kDefaultCookieableSchemes);
void CookieMonster::SetDefaultCookieableSchemes() {
- // Always disable file scheme unless SetEnableFileScheme(true) is called.
- SetCookieableSchemes(kDefaultCookieableSchemes,
- kDefaultCookieableSchemesCount - 1);
+ int num_schemes = default_enable_file_scheme_ ?
+ kDefaultCookieableSchemesCount : kDefaultCookieableSchemesCount - 1;
+ SetCookieableSchemes(kDefaultCookieableSchemes, num_schemes);
}
void CookieMonster::FindCookiesForHostAndDomain(
@@ -1737,7 +1744,7 @@
cookies_.insert(CookieMap::value_type(key, cc));
if (delegate_.get()) {
delegate_->OnCookieChanged(
- *cc, false, CookieMonsterDelegate::CHANGE_COOKIE_EXPLICIT);
+ *cc, false, CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT);
}
}
« no previous file with comments | « trunk/src/net/cookies/cookie_monster.h ('k') | trunk/src/net/cookies/cookie_monster_store_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698