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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.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 | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc » ('j') | 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_app.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.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/launcher/launcher_util.h" 10 #include "ash/launcher/launcher_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary( 128 const base::DictionaryValue* shelf_prefs = pref_service->GetDictionary(
129 prefs::kShelfPreferences); 129 prefs::kShelfPreferences);
130 const base::DictionaryValue* display_pref = NULL; 130 const base::DictionaryValue* display_pref = NULL;
131 std::string per_display_value; 131 std::string per_display_value;
132 if (shelf_prefs->GetDictionary(pref_key, &display_pref) && 132 if (shelf_prefs->GetDictionary(pref_key, &display_pref) &&
133 display_pref->GetString(path, &per_display_value)) 133 display_pref->GetString(path, &per_display_value))
134 return per_display_value; 134 return per_display_value;
135 135
136 // If the pref for the specified display is not found, scan the whole prefs 136 // If the pref for the specified display is not found, scan the whole prefs
137 // and check if the prefs for other display is already specified. 137 // and check if the prefs for other display is already specified.
138 std::string unused_value;
138 for (base::DictionaryValue::Iterator iter(*shelf_prefs); 139 for (base::DictionaryValue::Iterator iter(*shelf_prefs);
139 !iter.IsAtEnd(); iter.Advance()) { 140 !iter.IsAtEnd(); iter.Advance()) {
140 const base::DictionaryValue* display_pref = NULL; 141 const base::DictionaryValue* display_pref = NULL;
141 if (iter.value().GetAsDictionary(&display_pref) && 142 if (iter.value().GetAsDictionary(&display_pref) &&
142 display_pref->GetString(path, static_cast<std::string*>(NULL))) { 143 display_pref->GetString(path, &unused_value)) {
143 has_per_display_prefs = true; 144 has_per_display_prefs = true;
144 break; 145 break;
145 } 146 }
146 } 147 }
147 } 148 }
148 149
149 if (local_pref->IsRecommended() || !has_per_display_prefs) 150 if (local_pref->IsRecommended() || !has_per_display_prefs)
150 return value; 151 return value;
151 152
152 const base::Value* default_value = 153 const base::Value* default_value =
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 WebContents* web_contents = 1371 WebContents* web_contents =
1371 tab_strip->GetWebContentsAt(tab_strip->active_index()); 1372 tab_strip->GetWebContentsAt(tab_strip->active_index());
1372 gfx::Image app_icon = GetAppListIcon(web_contents); 1373 gfx::Image app_icon = GetAppListIcon(web_contents);
1373 items.push_back(new ChromeLauncherAppMenuItemBrowser( 1374 items.push_back(new ChromeLauncherAppMenuItemBrowser(
1374 web_contents->GetTitle(), 1375 web_contents->GetTitle(),
1375 app_icon.IsEmpty() ? NULL : &app_icon, 1376 app_icon.IsEmpty() ? NULL : &app_icon,
1376 browser)); 1377 browser));
1377 } 1378 }
1378 return items.Pass(); 1379 return items.Pass();
1379 } 1380 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698