Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/browser/extensions/platform_app_launcher.cc

Issue 10810053: Enables internal filesystem types via Isolated filesystems (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/app/app_api.h" 14 #include "chrome/browser/extensions/api/app/app_api.h"
15 #include "chrome/browser/extensions/extension_host.h" 15 #include "chrome/browser/extensions/extension_host.h"
16 #include "chrome/browser/extensions/extension_process_manager.h" 16 #include "chrome/browser/extensions/extension_process_manager.h"
17 #include "chrome/browser/extensions/extension_system.h" 17 #include "chrome/browser/extensions/extension_system.h"
18 #include "chrome/browser/extensions/lazy_background_task_queue.h" 18 #include "chrome/browser/extensions/lazy_background_task_queue.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/extensions/extension.h" 20 #include "chrome/common/extensions/extension.h"
21 #include "chrome/common/extensions/extension_messages.h" 21 #include "chrome/common/extensions/extension_messages.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/child_process_security_policy.h" 23 #include "content/public/browser/child_process_security_policy.h"
24 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
25 #include "net/base/mime_util.h" 25 #include "net/base/mime_util.h"
26 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
27 #include "webkit/fileapi/file_system_types.h"
27 #include "webkit/fileapi/isolated_context.h" 28 #include "webkit/fileapi/isolated_context.h"
28 #include "webkit/glue/web_intent_data.h" 29 #include "webkit/glue/web_intent_data.h"
29 #include "webkit/glue/web_intent_service_data.h" 30 #include "webkit/glue/web_intent_service_data.h"
30 31
31 using content::BrowserThread; 32 using content::BrowserThread;
32 using extensions::Extension; 33 using extensions::Extension;
33 using extensions::ExtensionSystem; 34 using extensions::ExtensionSystem;
34 35
35 namespace { 36 namespace {
36 37
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // If the renderer already has permission to read these paths, it is not 195 // If the renderer already has permission to read these paths, it is not
195 // regranted, as this would overwrite any other permissions which the 196 // regranted, as this would overwrite any other permissions which the
196 // renderer may already have. 197 // renderer may already have.
197 if (!policy->CanReadFile(renderer_id, file_path)) 198 if (!policy->CanReadFile(renderer_id, file_path))
198 policy->GrantReadFile(renderer_id, file_path); 199 policy->GrantReadFile(renderer_id, file_path);
199 200
200 std::string registered_name; 201 std::string registered_name;
201 fileapi::IsolatedContext* isolated_context = 202 fileapi::IsolatedContext* isolated_context =
202 fileapi::IsolatedContext::GetInstance(); 203 fileapi::IsolatedContext::GetInstance();
203 DCHECK(isolated_context); 204 DCHECK(isolated_context);
204 std::string filesystem_id = isolated_context->RegisterFileSystemForFile( 205 std::string filesystem_id = isolated_context->RegisterFileSystemForPath(
205 file_path, &registered_name); 206 fileapi::kFileSystemTypeIsolated, file_path, &registered_name);
206 // Granting read file system permission as well to allow file-system 207 // Granting read file system permission as well to allow file-system
207 // read operations. 208 // read operations.
208 policy->GrantReadFileSystem(renderer_id, filesystem_id); 209 policy->GrantReadFileSystem(renderer_id, filesystem_id);
209 210
210 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry( 211 extensions::AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
211 profile_, extension_, ASCIIToUTF16(kViewIntent), filesystem_id, 212 profile_, extension_, ASCIIToUTF16(kViewIntent), filesystem_id,
212 registered_name); 213 registered_name);
213 } 214 }
214 215
215 // The profile the app should be run in. 216 // The profile the app should be run in.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); 329 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data);
329 launcher->Launch(); 330 launcher->Launch();
330 return; 331 return;
331 } 332 }
332 333
333 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( 334 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent(
334 profile, extension, web_intent_data); 335 profile, extension, web_intent_data);
335 } 336 }
336 337
337 } // namespace extensions 338 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698