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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc

Issue 12212038: Do not pass NULL to GetAsString(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/ash/launcher/chrome_launcher_controller_per_browser. h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary( 187 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary(
188 prefs::kShelfPreferences); 188 prefs::kShelfPreferences);
189 const base::DictionaryValue* display_pref = NULL; 189 const base::DictionaryValue* display_pref = NULL;
190 std::string per_display_value; 190 std::string per_display_value;
191 if (shelf_prefs->GetDictionary(pref_key, &display_pref) && 191 if (shelf_prefs->GetDictionary(pref_key, &display_pref) &&
192 display_pref->GetString(path, &per_display_value)) 192 display_pref->GetString(path, &per_display_value))
193 return per_display_value; 193 return per_display_value;
194 194
195 // If the pref for the specified display is not found, scan the whole prefs 195 // If the pref for the specified display is not found, scan the whole prefs
196 // and check if the prefs for other display is already specified. 196 // and check if the prefs for other display is already specified.
197 std::string unused_value;
197 for (base::DictionaryValue::Iterator iter(*shelf_prefs); 198 for (base::DictionaryValue::Iterator iter(*shelf_prefs);
198 !iter.IsAtEnd(); iter.Advance()) { 199 !iter.IsAtEnd(); iter.Advance()) {
199 const base::DictionaryValue* display_pref = NULL; 200 const base::DictionaryValue* display_pref = NULL;
200 if (iter.value().GetAsDictionary(&display_pref) && 201 if (iter.value().GetAsDictionary(&display_pref) &&
201 display_pref->GetString(path, static_cast<std::string*>(NULL))) { 202 display_pref->GetString(path, &unused_value)) {
202 has_per_display_prefs = true; 203 has_per_display_prefs = true;
203 break; 204 break;
204 } 205 }
205 } 206 }
206 } 207 }
207 208
208 if (local_pref->IsRecommended() || !has_per_display_prefs) 209 if (local_pref->IsRecommended() || !has_per_display_prefs)
209 return value; 210 return value;
210 211
211 const base::Value* default_value = 212 const base::Value* default_value =
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( 1296 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest(
1296 ash::AppIconLoader* loader) { 1297 ash::AppIconLoader* loader) {
1297 app_icon_loader_.reset(loader); 1298 app_icon_loader_.reset(loader);
1298 } 1299 }
1299 1300
1300 const std::string& 1301 const std::string&
1301 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( 1302 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest(
1302 ash::LauncherID id) { 1303 ash::LauncherID id) {
1303 return id_to_item_controller_map_[id]->app_id(); 1304 return id_to_item_controller_map_[id]->app_id();
1304 } 1305 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698