| 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/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/metrics/metrics_service.h" | 14 #include "chrome/browser/metrics/metrics_service.h" |
| 15 #include "chrome/common/omaha_query_params.h" |
| 15 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // Maximum length of an extension manifest update check url, since it is a GET | 20 // Maximum length of an extension manifest update check url, since it is a GET |
| 20 // request. We want to stay under 2K because of proxies, etc. | 21 // request. We want to stay under 2K because of proxies, etc. |
| 21 const int kExtensionsManifestMaxURLSize = 2000; | 22 const int kExtensionsManifestMaxURLSize = 2000; |
| 22 | 23 |
| 23 } // namespace | 24 } // namespace |
| 24 | 25 |
| 25 namespace extensions { | 26 namespace extensions { |
| 26 | 27 |
| 27 ManifestFetchData::ManifestFetchData(const GURL& update_url, int request_id) | 28 ManifestFetchData::ManifestFetchData(const GURL& update_url, int request_id) |
| 28 : base_url_(update_url), | 29 : base_url_(update_url), |
| 29 full_url_(update_url) { | 30 full_url_(update_url) { |
| 31 chrome::OmahaQueryParams::ProdId prod = |
| 32 #if defined(GOOGLE_CHROME_BUILD) |
| 33 chrome::OmahaQueryParams::CHROMECRX; |
| 34 #else |
| 35 chrome::OmahaQueryParams::CHROMIUMCRX; |
| 36 #endif |
| 37 std::string query = full_url_.has_query() ? |
| 38 full_url_.query() + "&" : std::string(); |
| 39 query += chrome::OmahaQueryParams::Get(prod); |
| 40 GURL::Replacements replacements; |
| 41 replacements.SetQueryStr(query); |
| 42 full_url_ = full_url_.ReplaceComponents(replacements); |
| 43 |
| 30 request_ids_.insert(request_id); | 44 request_ids_.insert(request_id); |
| 31 } | 45 } |
| 32 | 46 |
| 33 ManifestFetchData::~ManifestFetchData() {} | 47 ManifestFetchData::~ManifestFetchData() {} |
| 34 | 48 |
| 35 // The format for request parameters in update checks is: | 49 // The format for request parameters in update checks is: |
| 36 // | 50 // |
| 37 // ?x=EXT1_INFO&x=EXT2_INFO | 51 // ?x=EXT1_INFO&x=EXT2_INFO |
| 38 // | 52 // |
| 39 // where EXT1_INFO and EXT2_INFO are url-encoded strings of the form: | 53 // where EXT1_INFO and EXT2_INFO are url-encoded strings of the form: |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 NOTREACHED(); | 160 NOTREACHED(); |
| 147 return value == kNeverPinged || value > 0; | 161 return value == kNeverPinged || value > 0; |
| 148 } | 162 } |
| 149 | 163 |
| 150 void ManifestFetchData::Merge(const ManifestFetchData& other) { | 164 void ManifestFetchData::Merge(const ManifestFetchData& other) { |
| 151 DCHECK(full_url() == other.full_url()); | 165 DCHECK(full_url() == other.full_url()); |
| 152 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); | 166 request_ids_.insert(other.request_ids_.begin(), other.request_ids_.end()); |
| 153 } | 167 } |
| 154 | 168 |
| 155 } // namespace extensions | 169 } // namespace extensions |
| OLD | NEW |