Commit 511524f1 authored by limasdf's avatar limasdf Committed by Commit bot

Use base::StringPairs where appropriate from /chrome

Becuase base/strings/string_split.h defines:
typedef std::vector<std::pair<std::string, std::string> > StringPairs;

BUG=412250

Review URL: https://codereview.chromium.org/568173004

Cr-Commit-Position: refs/heads/master@{#294707}
parent f6069db8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
#include "base/strings/string_split.h"
#include "chrome/browser/chromeos/drive/drive.pb.h" #include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/test_util.h" #include "chrome/browser/chromeos/drive/test_util.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
...@@ -198,8 +199,7 @@ TEST_F(ResourceMetadataStorageTest, GetIdByResourceId) { ...@@ -198,8 +199,7 @@ TEST_F(ResourceMetadataStorageTest, GetIdByResourceId) {
TEST_F(ResourceMetadataStorageTest, GetChildren) { TEST_F(ResourceMetadataStorageTest, GetChildren) {
const std::string parents_id[] = { "mercury", "venus", "mars", "jupiter", const std::string parents_id[] = { "mercury", "venus", "mars", "jupiter",
"saturn" }; "saturn" };
std::vector<std::vector<std::pair<std::string, std::string> > > std::vector<base::StringPairs> children_name_id(arraysize(parents_id));
children_name_id(arraysize(parents_id));
// Skip children_name_id[0/1] here because Mercury and Venus have no moon. // Skip children_name_id[0/1] here because Mercury and Venus have no moon.
children_name_id[2].push_back(std::make_pair("phobos", "mars_i")); children_name_id[2].push_back(std::make_pair("phobos", "mars_i"));
children_name_id[2].push_back(std::make_pair("deimos", "mars_ii")); children_name_id[2].push_back(std::make_pair("deimos", "mars_ii"));
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h" #include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/string_split.h"
#include "base/time/clock.h" #include "base/time/clock.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/content_settings/content_settings_rule.h"
...@@ -509,7 +510,7 @@ void PrefProvider::CanonicalizeContentSettingsExceptions( ...@@ -509,7 +510,7 @@ void PrefProvider::CanonicalizeContentSettingsExceptions(
DCHECK(all_settings_dictionary); DCHECK(all_settings_dictionary);
std::vector<std::string> remove_items; std::vector<std::string> remove_items;
std::vector<std::pair<std::string, std::string> > move_items; base::StringPairs move_items;
for (base::DictionaryValue::Iterator i(*all_settings_dictionary); for (base::DictionaryValue::Iterator i(*all_settings_dictionary);
!i.IsAtEnd(); !i.IsAtEnd();
i.Advance()) { i.Advance()) {
......
...@@ -165,7 +165,7 @@ void GaiaWebAuthFlow::OnAuthFlowURLChange(const GURL& url) { ...@@ -165,7 +165,7 @@ void GaiaWebAuthFlow::OnAuthFlowURLChange(const GURL& url) {
std::string fragment = url.GetContent().substr( std::string fragment = url.GetContent().substr(
redirect_path_prefix_.length(), std::string::npos); redirect_path_prefix_.length(), std::string::npos);
std::vector<std::pair<std::string, std::string> > pairs; base::StringPairs pairs;
base::SplitStringIntoKeyValuePairs(fragment, '=', '&', &pairs); base::SplitStringIntoKeyValuePairs(fragment, '=', '&', &pairs);
std::string access_token; std::string access_token;
std::string error; std::string error;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/prefs/testing_pref_service.h" #include "base/prefs/testing_pref_service.h"
#include "base/strings/string_split.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/prefs/interceptable_pref_filter.h" #include "chrome/browser/prefs/interceptable_pref_filter.h"
#include "chrome/browser/prefs/pref_hash_store.h" #include "chrome/browser/prefs/pref_hash_store.h"
...@@ -219,8 +220,7 @@ class TrackedPreferencesMigrationTest : public testing::Test { ...@@ -219,8 +220,7 @@ class TrackedPreferencesMigrationTest : public testing::Test {
// in the store identified by |store_id|. // in the store identified by |store_id|.
void VerifyValuesStored( void VerifyValuesStored(
MockPrefStoreID store_id, MockPrefStoreID store_id,
const std::vector<std::pair<std::string, std::string> >& const base::StringPairs& expected_prefs_in_store) {
expected_prefs_in_store) {
base::DictionaryValue* store = NULL; base::DictionaryValue* store = NULL;
switch (store_id) { switch (store_id) {
case MOCK_UNPROTECTED_PREF_STORE: case MOCK_UNPROTECTED_PREF_STORE:
...@@ -232,8 +232,7 @@ class TrackedPreferencesMigrationTest : public testing::Test { ...@@ -232,8 +232,7 @@ class TrackedPreferencesMigrationTest : public testing::Test {
} }
DCHECK(store); DCHECK(store);
for (std::vector<std::pair<std::string, std::string> >::const_iterator it = for (base::StringPairs::const_iterator it = expected_prefs_in_store.begin();
expected_prefs_in_store.begin();
it != expected_prefs_in_store.end(); ++it) { it != expected_prefs_in_store.end(); ++it) {
std::string val; std::string val;
EXPECT_TRUE(store->GetString(it->first, &val)); EXPECT_TRUE(store->GetString(it->first, &val));
...@@ -474,12 +473,12 @@ TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) { ...@@ -474,12 +473,12 @@ TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) {
EXPECT_FALSE(StoreModifiedByMigration(MOCK_UNPROTECTED_PREF_STORE)); EXPECT_FALSE(StoreModifiedByMigration(MOCK_UNPROTECTED_PREF_STORE));
EXPECT_FALSE(StoreModifiedByMigration(MOCK_PROTECTED_PREF_STORE)); EXPECT_FALSE(StoreModifiedByMigration(MOCK_PROTECTED_PREF_STORE));
std::vector<std::pair<std::string, std::string> > expected_unprotected_values; base::StringPairs expected_unprotected_values;
expected_unprotected_values.push_back( expected_unprotected_values.push_back(
std::make_pair(kUnprotectedPref, kUnprotectedPrefValue)); std::make_pair(kUnprotectedPref, kUnprotectedPrefValue));
VerifyValuesStored(MOCK_UNPROTECTED_PREF_STORE, expected_unprotected_values); VerifyValuesStored(MOCK_UNPROTECTED_PREF_STORE, expected_unprotected_values);
std::vector<std::pair<std::string, std::string> > expected_protected_values; base::StringPairs expected_protected_values;
expected_protected_values.push_back( expected_protected_values.push_back(
std::make_pair(kProtectedPref, kProtectedPrefValue)); std::make_pair(kProtectedPref, kProtectedPrefValue));
VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values);
......
...@@ -1211,7 +1211,7 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo( ...@@ -1211,7 +1211,7 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo(
if (disk_cache) { if (disk_cache) {
// Extract the statistics key/value pairs from the backend. // Extract the statistics key/value pairs from the backend.
std::vector<std::pair<std::string, std::string> > stats; base::StringPairs stats;
disk_cache->GetStats(&stats); disk_cache->GetStats(&stats);
for (size_t i = 0; i < stats.size(); ++i) { for (size_t i = 0; i < stats.size(); ++i) {
stats_dict->SetStringWithoutPathExpansion( stats_dict->SetStringWithoutPathExpansion(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment