| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/net/quota_policy_cookie_store.h" | 5 #include "content/browser/net/quota_policy_cookie_store.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <memory> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/cookie_store_factory.h" | 17 #include "content/public/browser/cookie_store_factory.h" |
| 18 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
| 19 #include "net/cookies/cookie_constants.h" | 19 #include "net/cookies/cookie_constants.h" |
| 20 #include "net/cookies/cookie_util.h" | 20 #include "net/cookies/cookie_util.h" |
| 21 #include "net/extras/sqlite/cookie_crypto_delegate.h" | 21 #include "net/extras/sqlite/cookie_crypto_delegate.h" |
| 22 #include "storage/browser/quota/special_storage_policy.h" | 22 #include "storage/browser/quota/special_storage_policy.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 session_cookie_mode(session_cookie_mode), | 122 session_cookie_mode(session_cookie_mode), |
| 123 storage_policy(storage_policy), | 123 storage_policy(storage_policy), |
| 124 cookie_delegate(cookie_delegate), | 124 cookie_delegate(cookie_delegate), |
| 125 crypto_delegate(nullptr) { | 125 crypto_delegate(nullptr) { |
| 126 CHECK(!path.empty() || session_cookie_mode == EPHEMERAL_SESSION_COOKIES); | 126 CHECK(!path.empty() || session_cookie_mode == EPHEMERAL_SESSION_COOKIES); |
| 127 } | 127 } |
| 128 | 128 |
| 129 CookieStoreConfig::~CookieStoreConfig() { | 129 CookieStoreConfig::~CookieStoreConfig() { |
| 130 } | 130 } |
| 131 | 131 |
| 132 scoped_ptr<net::CookieStore> CreateCookieStore( | 132 std::unique_ptr<net::CookieStore> CreateCookieStore( |
| 133 const CookieStoreConfig& config) { | 133 const CookieStoreConfig& config) { |
| 134 // TODO(bcwhite): Remove ScopedTracker below once crbug.com/483686 is fixed. | 134 // TODO(bcwhite): Remove ScopedTracker below once crbug.com/483686 is fixed. |
| 135 tracked_objects::ScopedTracker tracking_profile( | 135 tracked_objects::ScopedTracker tracking_profile( |
| 136 FROM_HERE_WITH_EXPLICIT_FUNCTION("483686 content::CreateCookieStore")); | 136 FROM_HERE_WITH_EXPLICIT_FUNCTION("483686 content::CreateCookieStore")); |
| 137 | 137 |
| 138 scoped_ptr<net::CookieMonster> cookie_monster; | 138 std::unique_ptr<net::CookieMonster> cookie_monster; |
| 139 | 139 |
| 140 if (config.path.empty()) { | 140 if (config.path.empty()) { |
| 141 // Empty path means in-memory store. | 141 // Empty path means in-memory store. |
| 142 cookie_monster.reset( | 142 cookie_monster.reset( |
| 143 new net::CookieMonster(nullptr, config.cookie_delegate.get())); | 143 new net::CookieMonster(nullptr, config.cookie_delegate.get())); |
| 144 } else { | 144 } else { |
| 145 scoped_refptr<base::SequencedTaskRunner> client_task_runner = | 145 scoped_refptr<base::SequencedTaskRunner> client_task_runner = |
| 146 config.client_task_runner; | 146 config.client_task_runner; |
| 147 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 147 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 148 config.background_task_runner; | 148 config.background_task_runner; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 if (!config.cookieable_schemes.empty()) | 185 if (!config.cookieable_schemes.empty()) |
| 186 cookie_monster->SetCookieableSchemes(config.cookieable_schemes); | 186 cookie_monster->SetCookieableSchemes(config.cookieable_schemes); |
| 187 | 187 |
| 188 return std::move(cookie_monster); | 188 return std::move(cookie_monster); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace content | 191 } // namespace content |
| OLD | NEW |