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_handler_util.h" | 5 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 matching_patterns)); | 220 matching_patterns)); |
221 } | 221 } |
222 | 222 |
223 SortLastUsedHandlerList(named_action_list); | 223 SortLastUsedHandlerList(named_action_list); |
224 return true; | 224 return true; |
225 } | 225 } |
226 | 226 |
227 bool GetDefaultTask( | 227 bool GetDefaultTask( |
228 Profile* profile, const GURL& url, const FileBrowserHandler** handler) { | 228 Profile* profile, const GURL& url, const FileBrowserHandler** handler) { |
229 std::vector<GURL> file_urls; | 229 std::vector<GURL> file_urls; |
230 file_urls.push_back(url); | 230 std::string url_spec = url.spec(); |
231 StringToLowerASCII(&url_spec); | |
SeRya
2012/03/14 09:08:55
How about non-ASCII patterns? A third party app ma
Vladislav Kaznacheev
2012/03/14 11:08:20
Done.
| |
232 file_urls.push_back(GURL(url_spec)); | |
231 | 233 |
232 LastUsedHandlerList common_tasks; | 234 LastUsedHandlerList common_tasks; |
233 if (!FindCommonTasks(profile, file_urls, &common_tasks)) | 235 if (!FindCommonTasks(profile, file_urls, &common_tasks)) |
234 return false; | 236 return false; |
235 | 237 |
236 if (common_tasks.size() == 0) | 238 if (common_tasks.size() == 0) |
237 return false; | 239 return false; |
238 | 240 |
239 *handler = common_tasks[0].handler; | 241 *handler = common_tasks[0].handler; |
240 return true; | 242 return true; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 base::JSONWriter::Write(event_args.get(), false, &json_args); | 540 base::JSONWriter::Write(event_args.get(), false, &json_args); |
539 event_router->DispatchEventToExtension( | 541 event_router->DispatchEventToExtension( |
540 extension_id_, std::string("fileBrowserHandler.onExecute"), | 542 extension_id_, std::string("fileBrowserHandler.onExecute"), |
541 json_args, profile_, | 543 json_args, profile_, |
542 GURL()); | 544 GURL()); |
543 Done(true); | 545 Done(true); |
544 } | 546 } |
545 | 547 |
546 } // namespace file_handler_util | 548 } // namespace file_handler_util |
547 | 549 |
OLD | NEW |