Chromium Code Reviews| 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/common/omaha_query_params/omaha_query_params.h" | 16 #include "chrome/common/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 NOTREACHED() << "Duplicate extension id " << id; | 71 NOTREACHED() << "Duplicate extension id " << id; |
| 71 return false; | 72 return false; |
| 72 } | 73 } |
| 73 | 74 |
| 74 // Compute the string we'd append onto the full_url_, and see if it fits. | 75 // Compute the string we'd append onto the full_url_, and see if it fits. |
| 75 std::vector<std::string> parts; | 76 std::vector<std::string> parts; |
| 76 parts.push_back("id=" + id); | 77 parts.push_back("id=" + id); |
| 77 parts.push_back("v=" + version); | 78 parts.push_back("v=" + version); |
| 78 if (!install_source.empty()) | 79 if (!install_source.empty()) |
| 79 parts.push_back("installsource=" + install_source); | 80 parts.push_back("installsource=" + install_source); |
| 81 parts.push_back("lang=" + g_browser_process->GetApplicationLocale()); | |
|
Devlin
2014/02/04 00:18:39
This is also done here: https://code.google.com/p/
Marijn Kruisselbrink
2014/02/10 21:06:46
I'm not entirely sure what you're suggesting putti
Devlin
2014/02/10 23:08:15
The OmahaQueryParams class is where we're getting
| |
| 80 parts.push_back("uc"); | 82 parts.push_back("uc"); |
| 81 | 83 |
| 82 if (!update_url_data.empty()) { | 84 if (!update_url_data.empty()) { |
| 83 // Make sure the update_url_data string is escaped before using it so that | 85 // Make sure the update_url_data string is escaped before using it so that |
| 84 // there is no chance of overriding the id or v other parameter value | 86 // there is no chance of overriding the id or v other parameter value |
| 85 // we place into the x= value. | 87 // we place into the x= value. |
| 86 parts.push_back("ap=" + net::EscapeQueryParamValue(update_url_data, true)); | 88 parts.push_back("ap=" + net::EscapeQueryParamValue(update_url_data, true)); |
| 87 } | 89 } |
| 88 | 90 |
| 89 // Append brand code, rollcall and active ping parameters. | 91 // Append brand code, rollcall and active ping parameters. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 NOTREACHED(); | 156 NOTREACHED(); |
| 155 return value == kNeverPinged || value > 0; | 157 return value == kNeverPinged || value > 0; |
| 156 } | 158 } |
| 157 | 159 |
| 158 void ManifestFetchData::Merge(const ManifestFetchData& other) { | 160 void ManifestFetchData::Merge(const ManifestFetchData& other) { |
| 159 DCHECK(full_url() == other.full_url()); | 161 DCHECK(full_url() == other.full_url()); |
| 160 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); | 162 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); |
| 161 } | 163 } |
| 162 | 164 |
| 163 } // namespace extensions | 165 } // namespace extensions |
| OLD | NEW |