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

Side by Side Diff: chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc

Issue 217533006: Introduce apps API target in //apps and move app.runtime API into it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix dependencies (app-runtime-move) Created 6 years, 8 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/api/file_handlers/app_file_handler_util.h" 5 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
6 6
7 #include "apps/browser/file_handler_util.h"
7 #include "base/file_util.h" 8 #include "base/file_util.h"
8 #include "base/files/file.h" 9 #include "base/files/file.h"
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/child_process_security_policy.h" 12 #include "content/public/browser/child_process_security_policy.h"
12 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
13 #include "extensions/browser/extension_prefs.h" 14 #include "extensions/browser/extension_prefs.h"
14 #include "net/base/mime_util.h" 15 #include "net/base/mime_util.h"
15 #include "webkit/browser/fileapi/isolated_context.h" 16 #include "webkit/browser/fileapi/isolated_context.h"
16 #include "webkit/common/fileapi/file_system_mount_option.h" 17 #include "webkit/common/fileapi/file_system_mount_option.h"
17 #include "webkit/common/fileapi/file_system_types.h" 18 #include "webkit/common/fileapi/file_system_types.h"
18 19
19 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/drive/file_system_util.h" 21 #include "chrome/browser/chromeos/drive/file_system_util.h"
21 #endif 22 #endif
22 23
24 using apps::file_handler_util::GrantedFileEntry;
25
23 namespace extensions { 26 namespace extensions {
24 27
25 namespace app_file_handler_util { 28 namespace app_file_handler_util {
26 29
27 const char kInvalidParameters[] = "Invalid parameters"; 30 const char kInvalidParameters[] = "Invalid parameters";
28 const char kSecurityError[] = "Security error"; 31 const char kSecurityError[] = "Security error";
29 32
30 namespace { 33 namespace {
31 34
32 bool FileHandlerCanHandleFileWithExtension( 35 bool FileHandlerCanHandleFileWithExtension(
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 const std::vector<base::FilePath>& paths, 344 const std::vector<base::FilePath>& paths,
342 Profile* profile, 345 Profile* profile,
343 bool is_directory, 346 bool is_directory,
344 const base::Closure& on_success, 347 const base::Closure& on_success,
345 const base::Callback<void(const base::FilePath&)>& on_failure) { 348 const base::Callback<void(const base::FilePath&)>& on_failure) {
346 scoped_refptr<WritableFileChecker> checker(new WritableFileChecker( 349 scoped_refptr<WritableFileChecker> checker(new WritableFileChecker(
347 paths, profile, is_directory, on_success, on_failure)); 350 paths, profile, is_directory, on_success, on_failure));
348 checker->Check(); 351 checker->Check();
349 } 352 }
350 353
351 GrantedFileEntry::GrantedFileEntry() {}
352
353 bool HasFileSystemWritePermission(const Extension* extension) { 354 bool HasFileSystemWritePermission(const Extension* extension) {
354 return extension->HasAPIPermission(APIPermission::kFileSystemWrite); 355 return extension->HasAPIPermission(APIPermission::kFileSystemWrite);
355 } 356 }
356 357
357 bool ValidateFileEntryAndGetPath( 358 bool ValidateFileEntryAndGetPath(
358 const std::string& filesystem_name, 359 const std::string& filesystem_name,
359 const std::string& filesystem_path, 360 const std::string& filesystem_path,
360 const content::RenderViewHost* render_view_host, 361 const content::RenderViewHost* render_view_host,
361 base::FilePath* file_path, 362 base::FilePath* file_path,
362 std::string* error) { 363 std::string* error) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 *error = kInvalidParameters; 403 *error = kInvalidParameters;
403 return false; 404 return false;
404 } 405 }
405 406
406 return true; 407 return true;
407 } 408 }
408 409
409 } // namespace app_file_handler_util 410 } // namespace app_file_handler_util
410 411
411 } // namespace extensions 412 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698