| 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 "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" | 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 7 #include <stdint.h> | 8 #include <stdint.h> |
| 8 | 9 |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/macros.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_storage_delegate.h" | 19 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_storage_delegate.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 const size_t kMaxEventsToStore = 100; | 23 const size_t kMaxEventsToStore = 100; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void DataReductionProxyEventStore::AddEventAndSecureProxyCheckState( | 175 void DataReductionProxyEventStore::AddEventAndSecureProxyCheckState( |
| 175 scoped_ptr<base::Value> event, | 176 scoped_ptr<base::Value> event, |
| 176 SecureProxyCheckState state) { | 177 SecureProxyCheckState state) { |
| 177 DCHECK(thread_checker_.CalledOnValidThread()); | 178 DCHECK(thread_checker_.CalledOnValidThread()); |
| 178 secure_proxy_check_state_ = state; | 179 secure_proxy_check_state_ = state; |
| 179 AddEvent(event.Pass()); | 180 AddEvent(event.Pass()); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void DataReductionProxyEventStore::AddAndSetLastBypassEvent( | 183 void DataReductionProxyEventStore::AddAndSetLastBypassEvent( |
| 183 scoped_ptr<base::Value> event, | 184 scoped_ptr<base::Value> event, |
| 184 int64 expiration_ticks) { | 185 int64_t expiration_ticks) { |
| 185 DCHECK(thread_checker_.CalledOnValidThread()); | 186 DCHECK(thread_checker_.CalledOnValidThread()); |
| 186 last_bypass_event_.reset(event->DeepCopy()); | 187 last_bypass_event_.reset(event->DeepCopy()); |
| 187 expiration_ticks_ = expiration_ticks; | 188 expiration_ticks_ = expiration_ticks; |
| 188 AddEvent(event.Pass()); | 189 AddEvent(event.Pass()); |
| 189 } | 190 } |
| 190 | 191 |
| 191 std::string DataReductionProxyEventStore::GetHttpProxyList() const { | 192 std::string DataReductionProxyEventStore::GetHttpProxyList() const { |
| 192 DCHECK(thread_checker_.CalledOnValidThread()); | 193 DCHECK(thread_checker_.CalledOnValidThread()); |
| 193 if (!enabled_ || !current_configuration_) | 194 if (!enabled_ || !current_configuration_) |
| 194 return std::string(); | 195 return std::string(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 last_bypass->SetString("url", clean_url.spec()); | 285 last_bypass->SetString("url", clean_url.spec()); |
| 285 } | 286 } |
| 286 } | 287 } |
| 287 | 288 |
| 288 std::string json; | 289 std::string json; |
| 289 base::JSONWriter::Write(*last_bypass.get(), &json); | 290 base::JSONWriter::Write(*last_bypass.get(), &json); |
| 290 return json; | 291 return json; |
| 291 } | 292 } |
| 292 | 293 |
| 293 } // namespace data_reduction_proxy | 294 } // namespace data_reduction_proxy |
| OLD | NEW |