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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 10407124: Don't force non-session only cookies to be session only cookies, instead delete on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/resource_context.h" 28 #include "content/public/browser/resource_context.h"
29 #include "net/base/server_bound_cert_service.h" 29 #include "net/base/server_bound_cert_service.h"
30 #include "net/ftp/ftp_network_layer.h" 30 #include "net/ftp/ftp_network_layer.h"
31 #include "net/http/http_cache.h" 31 #include "net/http/http_cache.h"
32 #include "net/url_request/url_request_job_factory.h" 32 #include "net/url_request/url_request_job_factory.h"
33 #include "webkit/quota/special_storage_policy.h"
33 34
34 using content::BrowserThread; 35 using content::BrowserThread;
35 36
36 ProfileImplIOData::Handle::Handle(Profile* profile) 37 ProfileImplIOData::Handle::Handle(Profile* profile)
37 : io_data_(new ProfileImplIOData), 38 : io_data_(new ProfileImplIOData),
38 profile_(profile), 39 profile_(profile),
39 initialized_(false) { 40 initialized_(false) {
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41 DCHECK(profile); 42 DCHECK(profile);
42 } 43 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const FilePath& server_bound_cert_path, 76 const FilePath& server_bound_cert_path,
76 const FilePath& cache_path, 77 const FilePath& cache_path,
77 int cache_max_size, 78 int cache_max_size,
78 const FilePath& media_cache_path, 79 const FilePath& media_cache_path,
79 int media_cache_max_size, 80 int media_cache_max_size,
80 const FilePath& extensions_cookie_path, 81 const FilePath& extensions_cookie_path,
81 const FilePath& app_path, 82 const FilePath& app_path,
82 chrome_browser_net::Predictor* predictor, 83 chrome_browser_net::Predictor* predictor,
83 PrefService* local_state, 84 PrefService* local_state,
84 IOThread* io_thread, 85 IOThread* io_thread,
85 bool restore_old_session_cookies) { 86 bool restore_old_session_cookies,
87 quota::SpecialStoragePolicy* special_storage_policy) {
86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
87 DCHECK(!io_data_->lazy_params_.get()); 89 DCHECK(!io_data_->lazy_params_.get());
88 DCHECK(predictor); 90 DCHECK(predictor);
89 91
90 LazyParams* lazy_params = new LazyParams; 92 LazyParams* lazy_params = new LazyParams;
91 93
92 lazy_params->cookie_path = cookie_path; 94 lazy_params->cookie_path = cookie_path;
93 lazy_params->server_bound_cert_path = server_bound_cert_path; 95 lazy_params->server_bound_cert_path = server_bound_cert_path;
94 lazy_params->cache_path = cache_path; 96 lazy_params->cache_path = cache_path;
95 lazy_params->cache_max_size = cache_max_size; 97 lazy_params->cache_max_size = cache_max_size;
96 lazy_params->media_cache_path = media_cache_path; 98 lazy_params->media_cache_path = media_cache_path;
97 lazy_params->media_cache_max_size = media_cache_max_size; 99 lazy_params->media_cache_max_size = media_cache_max_size;
98 lazy_params->extensions_cookie_path = extensions_cookie_path; 100 lazy_params->extensions_cookie_path = extensions_cookie_path;
99 lazy_params->restore_old_session_cookies = restore_old_session_cookies; 101 lazy_params->restore_old_session_cookies = restore_old_session_cookies;
102 lazy_params->special_storage_policy = special_storage_policy;
100 103
101 io_data_->lazy_params_.reset(lazy_params); 104 io_data_->lazy_params_.reset(lazy_params);
102 105
103 // Keep track of isolated app path separately so we can use it on demand. 106 // Keep track of isolated app path separately so we can use it on demand.
104 io_data_->app_path_ = app_path; 107 io_data_->app_path_ = app_path;
105 108
106 io_data_->predictor_.reset(predictor); 109 io_data_->predictor_.reset(predictor);
107 110
108 if (!main_request_context_getter_) { 111 if (!main_request_context_getter_) {
109 main_request_context_getter_ = 112 main_request_context_getter_ =
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 base::WorkerPool::GetTaskRunner(true)); 340 base::WorkerPool::GetTaskRunner(true));
338 } 341 }
339 342
340 // setup cookie store 343 // setup cookie store
341 if (!cookie_store) { 344 if (!cookie_store) {
342 DCHECK(!lazy_params_->cookie_path.empty()); 345 DCHECK(!lazy_params_->cookie_path.empty());
343 346
344 scoped_refptr<SQLitePersistentCookieStore> cookie_db = 347 scoped_refptr<SQLitePersistentCookieStore> cookie_db =
345 new SQLitePersistentCookieStore( 348 new SQLitePersistentCookieStore(
346 lazy_params_->cookie_path, 349 lazy_params_->cookie_path,
347 lazy_params_->restore_old_session_cookies); 350 lazy_params_->restore_old_session_cookies,
351 lazy_params_->special_storage_policy);
348 cookie_db->SetClearLocalStateOnExit( 352 cookie_db->SetClearLocalStateOnExit(
349 profile_params->clear_local_state_on_exit); 353 profile_params->clear_local_state_on_exit);
350 cookie_store = 354 cookie_store =
351 new net::CookieMonster(cookie_db.get(), 355 new net::CookieMonster(cookie_db.get(),
352 profile_params->cookie_monster_delegate); 356 profile_params->cookie_monster_delegate);
353 if (!command_line.HasSwitch(switches::kDisableRestoreSessionState)) 357 if (!command_line.HasSwitch(switches::kDisableRestoreSessionState))
354 cookie_store->GetCookieMonster()->SetPersistSessionCookies(true); 358 cookie_store->GetCookieMonster()->SetPersistSessionCookies(true);
355 } 359 }
356 360
357 net::CookieMonster* extensions_cookie_store = 361 net::CookieMonster* extensions_cookie_store =
358 new net::CookieMonster( 362 new net::CookieMonster(
359 new SQLitePersistentCookieStore( 363 new SQLitePersistentCookieStore(
360 lazy_params_->extensions_cookie_path, 364 lazy_params_->extensions_cookie_path,
361 lazy_params_->restore_old_session_cookies), NULL); 365 lazy_params_->restore_old_session_cookies, NULL), NULL);
362 // Enable cookies for devtools and extension URLs. 366 // Enable cookies for devtools and extension URLs.
363 const char* schemes[] = {chrome::kChromeDevToolsScheme, 367 const char* schemes[] = {chrome::kChromeDevToolsScheme,
364 chrome::kExtensionScheme}; 368 chrome::kExtensionScheme};
365 extensions_cookie_store->SetCookieableSchemes(schemes, 2); 369 extensions_cookie_store->SetCookieableSchemes(schemes, 2);
366 370
367 main_context->set_cookie_store(cookie_store); 371 main_context->set_cookie_store(cookie_store);
368 media_request_context_->set_cookie_store(cookie_store); 372 media_request_context_->set_cookie_store(cookie_store);
369 extensions_context->set_cookie_store(extensions_cookie_store); 373 extensions_context->set_cookie_store(extensions_cookie_store);
370 374
371 // Setup server bound cert service. 375 // Setup server bound cert service.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 cookie_store = new net::CookieMonster(NULL, NULL); 494 cookie_store = new net::CookieMonster(NULL, NULL);
491 app_http_cache->set_mode( 495 app_http_cache->set_mode(
492 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); 496 record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK);
493 } 497 }
494 498
495 // Use an app-specific cookie store. 499 // Use an app-specific cookie store.
496 if (!cookie_store) { 500 if (!cookie_store) {
497 DCHECK(!cookie_path.empty()); 501 DCHECK(!cookie_path.empty());
498 502
499 scoped_refptr<SQLitePersistentCookieStore> cookie_db = 503 scoped_refptr<SQLitePersistentCookieStore> cookie_db =
500 new SQLitePersistentCookieStore(cookie_path, false); 504 new SQLitePersistentCookieStore(cookie_path, false, NULL);
501 cookie_db->SetClearLocalStateOnExit(clear_local_state_on_exit_); 505 cookie_db->SetClearLocalStateOnExit(clear_local_state_on_exit_);
502 // TODO(creis): We should have a cookie delegate for notifying the cookie 506 // TODO(creis): We should have a cookie delegate for notifying the cookie
503 // extensions API, but we need to update it to understand isolated apps 507 // extensions API, but we need to update it to understand isolated apps
504 // first. 508 // first.
505 cookie_store = new net::CookieMonster(cookie_db.get(), NULL); 509 cookie_store = new net::CookieMonster(cookie_db.get(), NULL);
506 } 510 }
507 511
508 context->SetCookieStore(cookie_store); 512 context->SetCookieStore(cookie_store);
509 context->SetHttpTransactionFactory(app_http_cache); 513 context->SetHttpTransactionFactory(app_http_cache);
510 514
(...skipping 20 matching lines...) Expand all
531 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 535 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
532 base::Time time) { 536 base::Time time) {
533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
534 LazyInitialize(); 538 LazyInitialize();
535 539
536 DCHECK(transport_security_state()); 540 DCHECK(transport_security_state());
537 transport_security_state()->DeleteSince(time); 541 transport_security_state()->DeleteSince(time);
538 DCHECK(http_server_properties_manager()); 542 DCHECK(http_server_properties_manager());
539 http_server_properties_manager()->Clear(); 543 http_server_properties_manager()->Clear();
540 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698