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/platform_app_launcher.h" | 5 #include "chrome/browser/extensions/platform_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 content::ChildProcessSecurityPolicy::GetInstance(); | 161 content::ChildProcessSecurityPolicy::GetInstance(); |
162 int renderer_id = host->render_process_host()->GetID(); | 162 int renderer_id = host->render_process_host()->GetID(); |
163 | 163 |
164 // Granting read file permission to allow reading file content. | 164 // Granting read file permission to allow reading file content. |
165 // If the renderer already has permission to read these paths, it is not | 165 // If the renderer already has permission to read these paths, it is not |
166 // regranted, as this would overwrite any other permissions which the | 166 // regranted, as this would overwrite any other permissions which the |
167 // renderer may already have. | 167 // renderer may already have. |
168 if (!policy->CanReadFile(renderer_id, file_path)) | 168 if (!policy->CanReadFile(renderer_id, file_path)) |
169 policy->GrantReadFile(renderer_id, file_path); | 169 policy->GrantReadFile(renderer_id, file_path); |
170 | 170 |
171 std::set<FilePath> filesets; | 171 std::string registered_name; |
172 filesets.insert(file_path); | |
173 | |
174 fileapi::IsolatedContext* isolated_context = | 172 fileapi::IsolatedContext* isolated_context = |
175 fileapi::IsolatedContext::GetInstance(); | 173 fileapi::IsolatedContext::GetInstance(); |
176 DCHECK(isolated_context); | 174 DCHECK(isolated_context); |
177 std::string filesystem_id = isolated_context->RegisterIsolatedFileSystem( | 175 std::string filesystem_id = isolated_context->RegisterFileSystemForFile( |
178 filesets); | 176 file_path, ®istered_name); |
179 // Granting read file system permission as well to allow file-system | 177 // Granting read file system permission as well to allow file-system |
180 // read operations. | 178 // read operations. |
181 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 179 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
182 | 180 |
183 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry( | 181 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
184 profile_, extension_, ASCIIToUTF16(kViewIntent), filesystem_id, | 182 profile_, extension_, ASCIIToUTF16(kViewIntent), filesystem_id, |
185 file_path.BaseName()); | 183 registered_name); |
186 } | 184 } |
187 | 185 |
188 // The profile the app should be run in. | 186 // The profile the app should be run in. |
189 Profile* profile_; | 187 Profile* profile_; |
190 // The extension providing the app. | 188 // The extension providing the app. |
191 const Extension* extension_; | 189 const Extension* extension_; |
192 // The command line to be passed through to the app, or NULL. | 190 // The command line to be passed through to the app, or NULL. |
193 const CommandLine* command_line_; | 191 const CommandLine* command_line_; |
194 | 192 |
195 DISALLOW_COPY_AND_ASSIGN(PlatformAppCommandLineLauncher); | 193 DISALLOW_COPY_AND_ASSIGN(PlatformAppCommandLineLauncher); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); | 295 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); |
298 launcher->Launch(); | 296 launcher->Launch(); |
299 return; | 297 return; |
300 } | 298 } |
301 | 299 |
302 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( | 300 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( |
303 profile, extension, web_intent_data); | 301 profile, extension, web_intent_data); |
304 } | 302 } |
305 | 303 |
306 } // namespace extensions | 304 } // namespace extensions |
OLD | NEW |