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" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::PLATFORM_FILE_ASYNC; | 83 base::PLATFORM_FILE_ASYNC; |
84 | 84 |
85 const char kFileBrowserExtensionId[] = "hhaomjibdihmijegdhdafkllkbggdgoj"; | 85 const char kFileBrowserExtensionId[] = "hhaomjibdihmijegdhdafkllkbggdgoj"; |
86 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; | 86 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; |
87 | 87 |
88 // Returns process id of the process the extension is running in. | 88 // Returns process id of the process the extension is running in. |
89 int ExtractProcessFromExtensionId(const std::string& extension_id, | 89 int ExtractProcessFromExtensionId(const std::string& extension_id, |
90 Profile* profile) { | 90 Profile* profile) { |
91 GURL extension_url = | 91 GURL extension_url = |
92 Extension::GetBaseURLFromExtensionId(extension_id); | 92 Extension::GetBaseURLFromExtensionId(extension_id); |
93 ExtensionProcessManager* manager = profile->GetExtensionProcessManager(); | 93 ExtensionProcessManager* manager = |
| 94 extensions::ExtensionSystem::Get(profile)->process_manager(); |
94 | 95 |
95 SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); | 96 SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); |
96 if (!site_instance || !site_instance->HasProcess()) | 97 if (!site_instance || !site_instance->HasProcess()) |
97 return -1; | 98 return -1; |
98 content::RenderProcessHost* process = site_instance->GetProcess(); | 99 content::RenderProcessHost* process = site_instance->GetProcess(); |
99 | 100 |
100 return process->GetID(); | 101 return process->GetID(); |
101 } | 102 } |
102 | 103 |
103 bool IsBuiltinTask(const FileBrowserHandler* task) { | 104 bool IsBuiltinTask(const FileBrowserHandler* task) { |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 // Make sure this url really being used by the right caller extension. | 1057 // Make sure this url really being used by the right caller extension. |
1057 if (source_url_.GetOrigin() != url.origin()) | 1058 if (source_url_.GetOrigin() != url.origin()) |
1058 return false; | 1059 return false; |
1059 | 1060 |
1060 FilePath local_path = url.path(); | 1061 FilePath local_path = url.path(); |
1061 extensions::LaunchPlatformAppWithPath(profile(), GetExtension(), local_path); | 1062 extensions::LaunchPlatformAppWithPath(profile(), GetExtension(), local_path); |
1062 return true; | 1063 return true; |
1063 } | 1064 } |
1064 | 1065 |
1065 } // namespace file_handler_util | 1066 } // namespace file_handler_util |
OLD | NEW |