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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_tasks.cc

Issue 1279123004: Replace ToLower calls to the new format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/file_manager/file_tasks.h" 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
6 6
7 #include "apps/launcher.h" 7 #include "apps/launcher.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 } 163 }
164 164
165 if (!suffixes.empty()) { 165 if (!suffixes.empty()) {
166 DictionaryPrefUpdate mime_type_pref(pref_service, 166 DictionaryPrefUpdate mime_type_pref(pref_service,
167 prefs::kDefaultTasksBySuffix); 167 prefs::kDefaultTasksBySuffix);
168 for (std::set<std::string>::const_iterator iter = suffixes.begin(); 168 for (std::set<std::string>::const_iterator iter = suffixes.begin();
169 iter != suffixes.end(); ++iter) { 169 iter != suffixes.end(); ++iter) {
170 base::StringValue* value = new base::StringValue(task_id); 170 base::StringValue* value = new base::StringValue(task_id);
171 // Suffixes are case insensitive. 171 // Suffixes are case insensitive.
172 std::string lower_suffix = base::StringToLowerASCII(*iter); 172 std::string lower_suffix = base::ToLowerASCII(*iter);
173 mime_type_pref->SetWithoutPathExpansion(lower_suffix, value); 173 mime_type_pref->SetWithoutPathExpansion(lower_suffix, value);
174 } 174 }
175 } 175 }
176 } 176 }
177 177
178 std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service, 178 std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service,
179 const std::string& mime_type, 179 const std::string& mime_type,
180 const std::string& suffix) { 180 const std::string& suffix) {
181 VLOG(1) << "Looking for default for MIME type: " << mime_type 181 VLOG(1) << "Looking for default for MIME type: " << mime_type
182 << " and suffix: " << suffix; 182 << " and suffix: " << suffix;
183 std::string task_id; 183 std::string task_id;
184 if (!mime_type.empty()) { 184 if (!mime_type.empty()) {
185 const base::DictionaryValue* mime_task_prefs = 185 const base::DictionaryValue* mime_task_prefs =
186 pref_service.GetDictionary(prefs::kDefaultTasksByMimeType); 186 pref_service.GetDictionary(prefs::kDefaultTasksByMimeType);
187 DCHECK(mime_task_prefs); 187 DCHECK(mime_task_prefs);
188 LOG_IF(ERROR, !mime_task_prefs) << "Unable to open MIME type prefs"; 188 LOG_IF(ERROR, !mime_task_prefs) << "Unable to open MIME type prefs";
189 if (mime_task_prefs && 189 if (mime_task_prefs &&
190 mime_task_prefs->GetStringWithoutPathExpansion(mime_type, &task_id)) { 190 mime_task_prefs->GetStringWithoutPathExpansion(mime_type, &task_id)) {
191 VLOG(1) << "Found MIME default handler: " << task_id; 191 VLOG(1) << "Found MIME default handler: " << task_id;
192 return task_id; 192 return task_id;
193 } 193 }
194 } 194 }
195 195
196 const base::DictionaryValue* suffix_task_prefs = 196 const base::DictionaryValue* suffix_task_prefs =
197 pref_service.GetDictionary(prefs::kDefaultTasksBySuffix); 197 pref_service.GetDictionary(prefs::kDefaultTasksBySuffix);
198 DCHECK(suffix_task_prefs); 198 DCHECK(suffix_task_prefs);
199 LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix prefs"; 199 LOG_IF(ERROR, !suffix_task_prefs) << "Unable to open suffix prefs";
200 std::string lower_suffix = base::StringToLowerASCII(suffix); 200 std::string lower_suffix = base::ToLowerASCII(suffix);
201 if (suffix_task_prefs) 201 if (suffix_task_prefs)
202 suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id); 202 suffix_task_prefs->GetStringWithoutPathExpansion(lower_suffix, &task_id);
203 VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id; 203 VLOG_IF(1, !task_id.empty()) << "Found suffix default handler: " << task_id;
204 return task_id; 204 return task_id;
205 } 205 }
206 206
207 std::string MakeTaskID(const std::string& app_id, 207 std::string MakeTaskID(const std::string& app_id,
208 TaskType task_type, 208 TaskType task_type,
209 const std::string& action_id) { 209 const std::string& action_id) {
210 return base::StringPrintf("%s|%s|%s", 210 return base::StringPrintf("%s|%s|%s",
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 DCHECK(!task->is_default()); 565 DCHECK(!task->is_default());
566 if (IsFallbackFileHandler(task->task_descriptor())) { 566 if (IsFallbackFileHandler(task->task_descriptor())) {
567 task->set_is_default(true); 567 task->set_is_default(true);
568 return; 568 return;
569 } 569 }
570 } 570 }
571 } 571 }
572 572
573 } // namespace file_tasks 573 } // namespace file_tasks
574 } // namespace file_manager 574 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698