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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 }; | 550 }; |
551 | 551 |
552 static const int kUpdateFrequencySecs = 15; | 552 static const int kUpdateFrequencySecs = 15; |
553 | 553 |
554 // Takes a string with KEY=VALUE parameters separated by '&' in |params| and | 554 // Takes a string with KEY=VALUE parameters separated by '&' in |params| and |
555 // puts the key/value pairs into |result|. For keys with no value, the empty | 555 // puts the key/value pairs into |result|. For keys with no value, the empty |
556 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to | 556 // string is used. So for "a=1&b=foo&c", result would map "a" to "1", "b" to |
557 // "foo", and "c" to "". | 557 // "foo", and "c" to "". |
558 static void ExtractParameters(const std::string& params, | 558 static void ExtractParameters(const std::string& params, |
559 std::map<std::string, std::string>* result) { | 559 std::map<std::string, std::string>* result) { |
560 std::vector<std::string> pairs; | 560 for (const std::string& pair : base::SplitString( |
561 base::SplitString(params, '&', &pairs); | 561 params, "&", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
562 for (size_t i = 0; i < pairs.size(); i++) { | 562 std::vector<std::string> key_val = base::SplitString( |
563 std::vector<std::string> key_val; | 563 pair, "=", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
564 base::SplitString(pairs[i], '=', &key_val); | |
565 if (!key_val.empty()) { | 564 if (!key_val.empty()) { |
566 std::string key = key_val[0]; | 565 std::string key = key_val[0]; |
567 EXPECT_TRUE(result->find(key) == result->end()); | 566 EXPECT_TRUE(result->find(key) == result->end()); |
568 (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string(); | 567 (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string(); |
569 } else { | 568 } else { |
570 NOTREACHED(); | 569 NOTREACHED(); |
571 } | 570 } |
572 } | 571 } |
573 } | 572 } |
574 | 573 |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 // -prodversionmin (shouldn't update if browser version too old) | 2250 // -prodversionmin (shouldn't update if browser version too old) |
2252 // -manifests & updates arriving out of order / interleaved | 2251 // -manifests & updates arriving out of order / interleaved |
2253 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 2252 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
2254 // -An extension gets uninstalled while updates are in progress (so it doesn't | 2253 // -An extension gets uninstalled while updates are in progress (so it doesn't |
2255 // "come back from the dead") | 2254 // "come back from the dead") |
2256 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 2255 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
2257 // you don't get downgraded accidentally) | 2256 // you don't get downgraded accidentally) |
2258 // -An update manifest mentions multiple updates | 2257 // -An update manifest mentions multiple updates |
2259 | 2258 |
2260 } // namespace extensions | 2259 } // namespace extensions |
OLD | NEW |