| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const std::set<std::string>& suffixes, | 191 const std::set<std::string>& suffixes, |
| 192 const std::set<std::string>& mime_types) { | 192 const std::set<std::string>& mime_types) { |
| 193 if (!pref_service) | 193 if (!pref_service) |
| 194 return; | 194 return; |
| 195 | 195 |
| 196 if (!mime_types.empty()) { | 196 if (!mime_types.empty()) { |
| 197 DictionaryPrefUpdate mime_type_pref(pref_service, | 197 DictionaryPrefUpdate mime_type_pref(pref_service, |
| 198 prefs::kDefaultTasksByMimeType); | 198 prefs::kDefaultTasksByMimeType); |
| 199 for (std::set<std::string>::const_iterator iter = mime_types.begin(); | 199 for (std::set<std::string>::const_iterator iter = mime_types.begin(); |
| 200 iter != mime_types.end(); ++iter) { | 200 iter != mime_types.end(); ++iter) { |
| 201 base::StringValue* value = new base::StringValue(task_id); | 201 base::Value* value = new base::Value(task_id); |
| 202 mime_type_pref->SetWithoutPathExpansion(*iter, value); | 202 mime_type_pref->SetWithoutPathExpansion(*iter, value); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 if (!suffixes.empty()) { | 206 if (!suffixes.empty()) { |
| 207 DictionaryPrefUpdate mime_type_pref(pref_service, | 207 DictionaryPrefUpdate mime_type_pref(pref_service, |
| 208 prefs::kDefaultTasksBySuffix); | 208 prefs::kDefaultTasksBySuffix); |
| 209 for (std::set<std::string>::const_iterator iter = suffixes.begin(); | 209 for (std::set<std::string>::const_iterator iter = suffixes.begin(); |
| 210 iter != suffixes.end(); ++iter) { | 210 iter != suffixes.end(); ++iter) { |
| 211 base::StringValue* value = new base::StringValue(task_id); | 211 base::Value* value = new base::Value(task_id); |
| 212 // Suffixes are case insensitive. | 212 // Suffixes are case insensitive. |
| 213 std::string lower_suffix = base::ToLowerASCII(*iter); | 213 std::string lower_suffix = base::ToLowerASCII(*iter); |
| 214 mime_type_pref->SetWithoutPathExpansion(lower_suffix, value); | 214 mime_type_pref->SetWithoutPathExpansion(lower_suffix, value); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service, | 219 std::string GetDefaultTaskIdFromPrefs(const PrefService& pref_service, |
| 220 const std::string& mime_type, | 220 const std::string& mime_type, |
| 221 const std::string& suffix) { | 221 const std::string& suffix) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 DCHECK(!task->is_default()); | 640 DCHECK(!task->is_default()); |
| 641 if (IsFallbackFileHandler(task->task_descriptor())) { | 641 if (IsFallbackFileHandler(task->task_descriptor())) { |
| 642 task->set_is_default(true); | 642 task->set_is_default(true); |
| 643 return; | 643 return; |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 | 647 |
| 648 } // namespace file_tasks | 648 } // namespace file_tasks |
| 649 } // namespace file_manager | 649 } // namespace file_manager |
| OLD | NEW |