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 "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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const TaskDescriptor& task_descriptor, | 118 const TaskDescriptor& task_descriptor, |
119 const std::string& task_title, | 119 const std::string& task_title, |
120 const GURL& icon_url, | 120 const GURL& icon_url, |
121 bool is_default) | 121 bool is_default) |
122 : task_descriptor_(task_descriptor), | 122 : task_descriptor_(task_descriptor), |
123 task_title_(task_title), | 123 task_title_(task_title), |
124 icon_url_(icon_url), | 124 icon_url_(icon_url), |
125 is_default_(is_default){ | 125 is_default_(is_default){ |
126 } | 126 } |
127 | 127 |
128 scoped_ptr<base::DictionaryValue> | |
129 FullTaskDescriptor::AsDictionaryValue() const { | |
130 scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue); | |
131 dictionary->SetString("taskId", TaskDescriptorToId(task_descriptor_)); | |
132 if (!icon_url_.is_empty()) | |
133 dictionary->SetString("iconUrl", icon_url_.spec()); | |
134 dictionary->SetString("title", task_title_); | |
135 dictionary->SetBoolean("isDefault", is_default_); | |
136 return dictionary.Pass(); | |
137 } | |
138 | |
139 void UpdateDefaultTask(PrefService* pref_service, | 128 void UpdateDefaultTask(PrefService* pref_service, |
140 const std::string& task_id, | 129 const std::string& task_id, |
141 const std::set<std::string>& suffixes, | 130 const std::set<std::string>& suffixes, |
142 const std::set<std::string>& mime_types) { | 131 const std::set<std::string>& mime_types) { |
143 if (!pref_service) | 132 if (!pref_service) |
144 return; | 133 return; |
145 | 134 |
146 if (!mime_types.empty()) { | 135 if (!mime_types.empty()) { |
147 DictionaryPrefUpdate mime_type_pref(pref_service, | 136 DictionaryPrefUpdate mime_type_pref(pref_service, |
148 prefs::kDefaultTasksByMimeType); | 137 prefs::kDefaultTasksByMimeType); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if (file_browser_handlers::IsFallbackFileBrowserHandler( | 538 if (file_browser_handlers::IsFallbackFileBrowserHandler( |
550 task->task_descriptor())) { | 539 task->task_descriptor())) { |
551 task->set_is_default(true); | 540 task->set_is_default(true); |
552 return; | 541 return; |
553 } | 542 } |
554 } | 543 } |
555 } | 544 } |
556 | 545 |
557 } // namespace file_tasks | 546 } // namespace file_tasks |
558 } // namespace file_manager | 547 } // namespace file_manager |
OLD | NEW |