| 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/extensions/extension_file_browser_private_api.h" | 5 #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| 29 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 29 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
| 30 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 30 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 33 #include "chrome/common/extensions/file_browser_handler.h" | 33 #include "chrome/common/extensions/file_browser_handler.h" |
| 34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 35 #include "content/browser/child_process_security_policy.h" | 35 #include "content/browser/child_process_security_policy.h" |
| 36 #include "content/browser/renderer_host/render_view_host.h" | 36 #include "content/browser/renderer_host/render_view_host.h" |
| 37 #include "content/browser/site_instance.h" | |
| 38 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 39 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
| 39 #include "content/public/browser/site_instance.h" |
| 40 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
| 41 #include "googleurl/src/gurl.h" | 41 #include "googleurl/src/gurl.h" |
| 42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 43 #include "grit/platform_locale_settings.h" | 43 #include "grit/platform_locale_settings.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 45 #include "webkit/fileapi/file_system_context.h" | 45 #include "webkit/fileapi/file_system_context.h" |
| 46 #include "webkit/fileapi/file_system_file_util.h" | 46 #include "webkit/fileapi/file_system_file_util.h" |
| 47 #include "webkit/fileapi/file_system_mount_point_provider.h" | 47 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 48 #include "webkit/fileapi/file_system_operation_context.h" | 48 #include "webkit/fileapi/file_system_operation_context.h" |
| 49 #include "webkit/fileapi/file_system_types.h" | 49 #include "webkit/fileapi/file_system_types.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 void ExtractTargetExtensionAndProcessID() { | 722 void ExtractTargetExtensionAndProcessID() { |
| 723 // Get task details. | 723 // Get task details. |
| 724 std::string action_id; | 724 std::string action_id; |
| 725 if (!CrackTaskIdentifier(task_id_, &target_extension_id_, &action_id)) | 725 if (!CrackTaskIdentifier(task_id_, &target_extension_id_, &action_id)) |
| 726 return; | 726 return; |
| 727 | 727 |
| 728 GURL extension_url = | 728 GURL extension_url = |
| 729 Extension::GetBaseURLFromExtensionId(target_extension_id_); | 729 Extension::GetBaseURLFromExtensionId(target_extension_id_); |
| 730 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); | 730 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); |
| 731 | 731 |
| 732 SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); | 732 content::SiteInstance* site_instance = manager->GetSiteInstanceForURL( |
| 733 extension_url); |
| 733 if (!site_instance || !site_instance->HasProcess()) | 734 if (!site_instance || !site_instance->HasProcess()) |
| 734 return; | 735 return; |
| 735 content::RenderProcessHost* process = site_instance->GetProcess(); | 736 content::RenderProcessHost* process = site_instance->GetProcess(); |
| 736 | 737 |
| 737 target_process_id_ = process->GetID(); | 738 target_process_id_ = process->GetID(); |
| 738 } | 739 } |
| 739 | 740 |
| 740 // Checks legitimacy of file url and grants file RO access permissions from | 741 // Checks legitimacy of file url and grants file RO access permissions from |
| 741 // handler (target) extension and its renderer process. | 742 // handler (target) extension and its renderer process. |
| 742 bool SetupFileAccessPermissions(const GURL& origin_file_url, | 743 bool SetupFileAccessPermissions(const GURL& origin_file_url, |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 SET_STRING(IDS_FILE_BROWSER, ENQUEUE); | 1689 SET_STRING(IDS_FILE_BROWSER, ENQUEUE); |
| 1689 #undef SET_STRING | 1690 #undef SET_STRING |
| 1690 | 1691 |
| 1691 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); | 1692 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); |
| 1692 | 1693 |
| 1693 dict->SetString("PLAY_MEDIA", | 1694 dict->SetString("PLAY_MEDIA", |
| 1694 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1695 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
| 1695 | 1696 |
| 1696 return true; | 1697 return true; |
| 1697 } | 1698 } |
| OLD | NEW |