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/quota_policy_channel_id_store.h" | 5 #include "chrome/browser/net/quota_policy_channel_id_store.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
18 #include "net/cookies/cookie_util.h" | 18 #include "net/cookies/cookie_util.h" |
19 #include "net/extras/sqlite/sqlite_channel_id_store.h" | 19 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 #include "webkit/browser/quota/special_storage_policy.h" | 21 #include "webkit/browser/quota/special_storage_policy.h" |
22 | 22 |
23 QuotaPolicyChannelIDStore::QuotaPolicyChannelIDStore( | 23 QuotaPolicyChannelIDStore::QuotaPolicyChannelIDStore( |
24 const base::FilePath& path, | 24 const base::FilePath& path, |
25 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 25 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
26 storage::SpecialStoragePolicy* special_storage_policy) | 26 const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy) |
27 : special_storage_policy_(special_storage_policy), | 27 : special_storage_policy_(special_storage_policy), |
28 persistent_store_( | 28 persistent_store_( |
29 new net::SQLiteChannelIDStore(path, background_task_runner)) { | 29 new net::SQLiteChannelIDStore(path, background_task_runner)) { |
30 DCHECK(background_task_runner); | 30 DCHECK(background_task_runner.get()); |
31 } | 31 } |
32 | 32 |
33 QuotaPolicyChannelIDStore::~QuotaPolicyChannelIDStore() { | 33 QuotaPolicyChannelIDStore::~QuotaPolicyChannelIDStore() { |
34 if (!special_storage_policy_.get() || | 34 if (!special_storage_policy_.get() || |
35 !special_storage_policy_->HasSessionOnlyOrigins()) { | 35 !special_storage_policy_->HasSessionOnlyOrigins()) { |
36 return; | 36 return; |
37 } | 37 } |
38 std::list<std::string> session_only_server_identifiers; | 38 std::list<std::string> session_only_server_identifiers; |
39 for (std::set<std::string>::iterator it = server_identifiers_.begin(); | 39 for (std::set<std::string>::iterator it = server_identifiers_.begin(); |
40 it != server_identifiers_.end(); | 40 it != server_identifiers_.end(); |
(...skipping 29 matching lines...) Expand all Loading... |
70 void QuotaPolicyChannelIDStore::OnLoad( | 70 void QuotaPolicyChannelIDStore::OnLoad( |
71 const LoadedCallback& loaded_callback, | 71 const LoadedCallback& loaded_callback, |
72 scoped_ptr<ChannelIDVector> channel_ids) { | 72 scoped_ptr<ChannelIDVector> channel_ids) { |
73 for (ChannelIDVector::const_iterator channel_id = channel_ids->begin(); | 73 for (ChannelIDVector::const_iterator channel_id = channel_ids->begin(); |
74 channel_id != channel_ids->end(); | 74 channel_id != channel_ids->end(); |
75 ++channel_id) { | 75 ++channel_id) { |
76 server_identifiers_.insert((*channel_id)->server_identifier()); | 76 server_identifiers_.insert((*channel_id)->server_identifier()); |
77 } | 77 } |
78 loaded_callback.Run(channel_ids.Pass()); | 78 loaded_callback.Run(channel_ids.Pass()); |
79 } | 79 } |
OLD | NEW |