| 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/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| 15 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h" | 15 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h" |
| 16 #include "chrome/browser/chromeos/gdata/drive_task_executor.h" | 16 #include "chrome/browser/chromeos/gdata/drive_task_executor.h" |
| 17 #include "chrome/browser/extensions/event_router.h" | 17 #include "chrome/browser/extensions/event_router.h" |
| 18 #include "chrome/browser/extensions/extension_host.h" | 18 #include "chrome/browser/extensions/extension_host.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_system.h" | 20 #include "chrome/browser/extensions/extension_system.h" |
| 21 #include "chrome/browser/extensions/extension_tab_util.h" | 21 #include "chrome/browser/extensions/extension_tab_util.h" |
| 22 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 22 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
| 23 #include "chrome/browser/extensions/platform_app_launcher.h" | 23 #include "chrome/browser/extensions/platform_app_launcher.h" |
| 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 29 #include "chrome/browser/ui/browser_tabstrip.h" | 29 #include "chrome/browser/ui/browser_tabstrip.h" |
| 30 #include "chrome/browser/ui/host_desktop.h" |
| 30 #include "chrome/common/extensions/file_browser_handler.h" | 31 #include "chrome/common/extensions/file_browser_handler.h" |
| 31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/child_process_security_policy.h" | 34 #include "content/public/browser/child_process_security_policy.h" |
| 34 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
| 35 #include "content/public/browser/site_instance.h" | 36 #include "content/public/browser/site_instance.h" |
| 36 #include "content/public/browser/storage_partition.h" | 37 #include "content/public/browser/storage_partition.h" |
| 37 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 38 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 39 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" | 40 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 597 |
| 597 FileTaskExecutor::~FileTaskExecutor() { | 598 FileTaskExecutor::~FileTaskExecutor() { |
| 598 } | 599 } |
| 599 | 600 |
| 600 bool FileTaskExecutor::Execute(const std::vector<GURL>& file_urls) { | 601 bool FileTaskExecutor::Execute(const std::vector<GURL>& file_urls) { |
| 601 return ExecuteAndNotify(file_urls, FileTaskFinishedCallback()); | 602 return ExecuteAndNotify(file_urls, FileTaskFinishedCallback()); |
| 602 } | 603 } |
| 603 | 604 |
| 604 Browser* FileTaskExecutor::GetBrowser() const { | 605 Browser* FileTaskExecutor::GetBrowser() const { |
| 605 return browser::FindOrCreateTabbedBrowser( | 606 return browser::FindOrCreateTabbedBrowser( |
| 606 profile_ ? profile_ : ProfileManager::GetDefaultProfileOrOffTheRecord()); | 607 profile_ ? profile_ : ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 608 chrome::HOST_DESKTOP_TYPE_ASH); |
| 607 } | 609 } |
| 608 | 610 |
| 609 const Extension* FileTaskExecutor::GetExtension() { | 611 const Extension* FileTaskExecutor::GetExtension() { |
| 610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 611 | 613 |
| 612 ExtensionService* service = profile()->GetExtensionService(); | 614 ExtensionService* service = profile()->GetExtensionService(); |
| 613 return service ? service->GetExtensionById(extension_id_, false) : | 615 return service ? service->GetExtensionById(extension_id_, false) : |
| 614 NULL; | 616 NULL; |
| 615 } | 617 } |
| 616 | 618 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 // Make sure this url really being used by the right caller extension. | 1058 // Make sure this url really being used by the right caller extension. |
| 1057 if (source_url_.GetOrigin() != url.origin()) | 1059 if (source_url_.GetOrigin() != url.origin()) |
| 1058 return false; | 1060 return false; |
| 1059 | 1061 |
| 1060 FilePath local_path = url.path(); | 1062 FilePath local_path = url.path(); |
| 1061 extensions::LaunchPlatformAppWithPath(profile(), GetExtension(), local_path); | 1063 extensions::LaunchPlatformAppWithPath(profile(), GetExtension(), local_path); |
| 1062 return true; | 1064 return true; |
| 1063 } | 1065 } |
| 1064 | 1066 |
| 1065 } // namespace file_handler_util | 1067 } // namespace file_handler_util |
| OLD | NEW |