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/extensions/file_manager/file_tasks.h" | 5 #include "chrome/browser/chromeos/extensions/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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const TaskDescriptor& task_descriptor, | 115 const TaskDescriptor& task_descriptor, |
116 const std::string& task_title, | 116 const std::string& task_title, |
117 const GURL& icon_url, | 117 const GURL& icon_url, |
118 bool is_default) | 118 bool is_default) |
119 : task_descriptor_(task_descriptor), | 119 : task_descriptor_(task_descriptor), |
120 task_title_(task_title), | 120 task_title_(task_title), |
121 icon_url_(icon_url), | 121 icon_url_(icon_url), |
122 is_default_(is_default){ | 122 is_default_(is_default){ |
123 } | 123 } |
124 | 124 |
125 scoped_ptr<base::DictionaryValue> | |
126 FullTaskDescriptor::AsDictionaryValue() const { | |
127 scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue); | |
128 dictionary->SetString("taskId", TaskDescriptorToId(task_descriptor_)); | |
129 if (!icon_url_.is_empty()) | |
130 dictionary->SetString("iconUrl", icon_url_.spec()); | |
131 dictionary->SetBoolean("driveApp", | |
132 task_descriptor_.task_type == TASK_TYPE_DRIVE_APP); | |
133 dictionary->SetString("title", task_title_); | |
134 dictionary->SetBoolean("isDefault", is_default_); | |
135 return dictionary.Pass(); | |
136 } | |
137 | |
138 void UpdateDefaultTask(PrefService* pref_service, | 125 void UpdateDefaultTask(PrefService* pref_service, |
139 const std::string& task_id, | 126 const std::string& task_id, |
140 const std::set<std::string>& suffixes, | 127 const std::set<std::string>& suffixes, |
141 const std::set<std::string>& mime_types) { | 128 const std::set<std::string>& mime_types) { |
142 if (!pref_service) | 129 if (!pref_service) |
143 return; | 130 return; |
144 | 131 |
145 if (!mime_types.empty()) { | 132 if (!mime_types.empty()) { |
146 DictionaryPrefUpdate mime_type_pref(pref_service, | 133 DictionaryPrefUpdate mime_type_pref(pref_service, |
147 prefs::kDefaultTasksByMimeType); | 134 prefs::kDefaultTasksByMimeType); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if (file_browser_handlers::IsFallbackFileBrowserHandler( | 564 if (file_browser_handlers::IsFallbackFileBrowserHandler( |
578 task->task_descriptor())) { | 565 task->task_descriptor())) { |
579 task->set_is_default(true); | 566 task->set_is_default(true); |
580 return; | 567 return; |
581 } | 568 } |
582 } | 569 } |
583 } | 570 } |
584 | 571 |
585 } // namespace file_tasks | 572 } // namespace file_tasks |
586 } // namespace file_manager | 573 } // namespace file_manager |
OLD | NEW |