Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/chromeos/display/display_preferences.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include "ash/display/display_layout_store.h" 7 #include "ash/display/display_layout_store.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/display/display_pref_util.h" 9 #include "ash/display/display_pref_util.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 prefs::kSecondaryDisplays); 114 prefs::kSecondaryDisplays);
115 for (base::DictionaryValue::Iterator it(*layouts); 115 for (base::DictionaryValue::Iterator it(*layouts);
116 !it.IsAtEnd(); it.Advance()) { 116 !it.IsAtEnd(); it.Advance()) {
117 ash::DisplayLayout layout; 117 ash::DisplayLayout layout;
118 if (!ash::DisplayLayout::ConvertFromValue(it.value(), &layout)) { 118 if (!ash::DisplayLayout::ConvertFromValue(it.value(), &layout)) {
119 LOG(WARNING) << "Invalid preference value for " << it.key(); 119 LOG(WARNING) << "Invalid preference value for " << it.key();
120 continue; 120 continue;
121 } 121 }
122 122
123 if (it.key().find(",") != std::string::npos) { 123 if (it.key().find(",") != std::string::npos) {
124 std::vector<std::string> ids; 124 std::vector<std::string> ids = base::SplitString(
125 base::SplitString(it.key(), ',', &ids); 125 it.key(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
126 int64 id1 = gfx::Display::kInvalidDisplayID; 126 int64 id1 = gfx::Display::kInvalidDisplayID;
127 int64 id2 = gfx::Display::kInvalidDisplayID; 127 int64 id2 = gfx::Display::kInvalidDisplayID;
128 if (!base::StringToInt64(ids[0], &id1) || 128 if (!base::StringToInt64(ids[0], &id1) ||
129 !base::StringToInt64(ids[1], &id2) || 129 !base::StringToInt64(ids[1], &id2) ||
130 id1 == gfx::Display::kInvalidDisplayID || 130 id1 == gfx::Display::kInvalidDisplayID ||
131 id2 == gfx::Display::kInvalidDisplayID) { 131 id2 == gfx::Display::kInvalidDisplayID) {
132 continue; 132 continue;
133 } 133 }
134 layout_store->RegisterLayoutForDisplayIdPair(id1, id2, layout); 134 layout_store->RegisterLayoutForDisplayIdPair(id1, id2, layout);
135 } 135 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 const ash::DisplayLayout& layout) { 396 const ash::DisplayLayout& layout) {
397 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout); 397 StoreDisplayLayoutPref(std::make_pair(id1, id2), layout);
398 } 398 }
399 399
400 // Stores the given |power_state|. 400 // Stores the given |power_state|.
401 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) { 401 void StoreDisplayPowerStateForTest(DisplayPowerState power_state) {
402 StoreDisplayPowerState(power_state); 402 StoreDisplayPowerState(power_state);
403 } 403 }
404 404
405 } // namespace chromeos 405 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698