OLD | NEW |
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/extensions/updater/manifest_fetch_data.h" | 5 #include "chrome/browser/extensions/updater/manifest_fetch_data.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/google/google_util.h" | 14 #include "chrome/browser/google/google_util.h" |
14 #include "chrome/browser/metrics/metrics_service.h" | 15 #include "chrome/browser/metrics/metrics_service.h" |
15 #include "chrome/browser/omaha_query_params/omaha_query_params.h" | 16 #include "chrome/browser/omaha_query_params/omaha_query_params.h" |
16 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Maximum length of an extension manifest update check url, since it is a GET | 21 // Maximum length of an extension manifest update check url, since it is a GET |
21 // request. We want to stay under 2K because of proxies, etc. | 22 // request. We want to stay under 2K because of proxies, etc. |
22 const int kExtensionsManifestMaxURLSize = 2000; | 23 const int kExtensionsManifestMaxURLSize = 2000; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 parts.push_back("brand=" + brand); | 97 parts.push_back("brand=" + brand); |
97 #endif | 98 #endif |
98 | 99 |
99 std::string ping_value; | 100 std::string ping_value; |
100 pings_[id] = PingData(0, 0, false); | 101 pings_[id] = PingData(0, 0, false); |
101 | 102 |
102 if (ping_data) { | 103 if (ping_data) { |
103 if (ping_data->rollcall_days == kNeverPinged || | 104 if (ping_data->rollcall_days == kNeverPinged || |
104 ping_data->rollcall_days > 0) { | 105 ping_data->rollcall_days > 0) { |
105 ping_value += "r=" + base::IntToString(ping_data->rollcall_days); | 106 ping_value += "r=" + base::IntToString(ping_data->rollcall_days); |
106 if (MetricsServiceHelper::IsMetricsReportingEnabled()) { | 107 if (MetricsServiceHelper::IsMetricsReportingEnabled( |
| 108 g_browser_process->local_state())) { |
107 ping_value += "&e=" + std::string(ping_data->is_enabled ? "1" : "0"); | 109 ping_value += "&e=" + std::string(ping_data->is_enabled ? "1" : "0"); |
108 } | 110 } |
109 pings_[id].rollcall_days = ping_data->rollcall_days; | 111 pings_[id].rollcall_days = ping_data->rollcall_days; |
110 pings_[id].is_enabled = ping_data->is_enabled; | 112 pings_[id].is_enabled = ping_data->is_enabled; |
111 } | 113 } |
112 if (ping_data->active_days == kNeverPinged || | 114 if (ping_data->active_days == kNeverPinged || |
113 ping_data->active_days > 0) { | 115 ping_data->active_days > 0) { |
114 if (!ping_value.empty()) | 116 if (!ping_value.empty()) |
115 ping_value += "&"; | 117 ping_value += "&"; |
116 ping_value += "a=" + base::IntToString(ping_data->active_days); | 118 ping_value += "a=" + base::IntToString(ping_data->active_days); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 NOTREACHED(); | 158 NOTREACHED(); |
157 return value == kNeverPinged || value > 0; | 159 return value == kNeverPinged || value > 0; |
158 } | 160 } |
159 | 161 |
160 void ManifestFetchData::Merge(const ManifestFetchData& other) { | 162 void ManifestFetchData::Merge(const ManifestFetchData& other) { |
161 DCHECK(full_url() == other.full_url()); | 163 DCHECK(full_url() == other.full_url()); |
162 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); | 164 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); |
163 } | 165 } |
164 | 166 |
165 } // namespace extensions | 167 } // namespace extensions |
OLD | NEW |