| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cookie_store_util.h" | 5 #include "chrome/browser/net/cookie_store_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 const base::Callback<Profile*(void)> profile_getter_; | 76 const base::Callback<Profile*(void)> profile_getter_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 namespace chrome_browser_net { | 81 namespace chrome_browser_net { |
| 82 | 82 |
| 83 bool IsCookieRecordMode() { | |
| 84 const base::CommandLine& command_line = | |
| 85 *base::CommandLine::ForCurrentProcess(); | |
| 86 // Only allow Record Mode if we are in a Debug build or where we are running | |
| 87 // a cycle, and the user has limited control. | |
| 88 return command_line.HasSwitch(switches::kRecordMode) && | |
| 89 chrome::kRecordModeEnabled; | |
| 90 } | |
| 91 | |
| 92 bool ShouldUseInMemoryCookiesAndCache() { | |
| 93 const base::CommandLine& command_line = | |
| 94 *base::CommandLine::ForCurrentProcess(); | |
| 95 return IsCookieRecordMode() || | |
| 96 command_line.HasSwitch(switches::kPlaybackMode); | |
| 97 } | |
| 98 | |
| 99 net::CookieMonsterDelegate* CreateCookieDelegate(Profile* profile) { | 83 net::CookieMonsterDelegate* CreateCookieDelegate(Profile* profile) { |
| 100 return new EvictedDomainCookieCounter( | 84 return new EvictedDomainCookieCounter( |
| 101 new ChromeCookieMonsterDelegate(profile)); | 85 new ChromeCookieMonsterDelegate(profile)); |
| 102 } | 86 } |
| 103 | 87 |
| 104 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 88 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
| 105 namespace { | 89 namespace { |
| 106 | 90 |
| 107 // Use the operating system's mechanisms to encrypt cookies before writing | 91 // Use the operating system's mechanisms to encrypt cookies before writing |
| 108 // them to persistent store. Currently this only is done with desktop OS's | 92 // them to persistent store. Currently this only is done with desktop OS's |
| (...skipping 29 matching lines...) Expand all Loading... |
| 138 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { | 122 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { |
| 139 return g_cookie_crypto_delegate.Pointer(); | 123 return g_cookie_crypto_delegate.Pointer(); |
| 140 } | 124 } |
| 141 #else // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 125 #else // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
| 142 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { | 126 content::CookieCryptoDelegate* GetCookieCryptoDelegate() { |
| 143 return NULL; | 127 return NULL; |
| 144 } | 128 } |
| 145 #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 129 #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
| 146 | 130 |
| 147 } // namespace chrome_browser_net | 131 } // namespace chrome_browser_net |
| OLD | NEW |