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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/ui/browser_window.h" 34 #include "chrome/browser/ui/browser_window.h"
35 #include "chrome/browser/ui/extensions/application_launch.h" 35 #include "chrome/browser/ui/extensions/application_launch.h"
36 #include "chrome/browser/ui/simple_message_box.h" 36 #include "chrome/browser/ui/simple_message_box.h"
37 #include "chrome/browser/ui/tab_contents/tab_contents.h" 37 #include "chrome/browser/ui/tab_contents/tab_contents.h"
38 #include "chrome/browser/ui/tabs/tab_strip_model.h" 38 #include "chrome/browser/ui/tabs/tab_strip_model.h"
39 #include "chrome/common/chrome_paths.h" 39 #include "chrome/common/chrome_paths.h"
40 #include "chrome/common/extensions/file_browser_handler.h" 40 #include "chrome/common/extensions/file_browser_handler.h"
41 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
42 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
43 #include "content/public/browser/plugin_service.h" 43 #include "content/public/browser/plugin_service.h"
44 #include "content/public/browser/storage_partition.h"
44 #include "content/public/browser/user_metrics.h" 45 #include "content/public/browser/user_metrics.h"
45 #include "content/public/browser/web_contents.h" 46 #include "content/public/browser/web_contents.h"
46 #include "grit/generated_resources.h" 47 #include "grit/generated_resources.h"
47 #include "net/base/escape.h" 48 #include "net/base/escape.h"
48 #include "net/base/net_util.h" 49 #include "net/base/net_util.h"
49 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
50 #include "ui/gfx/screen.h" 51 #include "ui/gfx/screen.h"
51 #include "webkit/fileapi/file_system_context.h" 52 #include "webkit/fileapi/file_system_context.h"
52 #include "webkit/fileapi/file_system_mount_point_provider.h" 53 #include "webkit/fileapi/file_system_mount_point_provider.h"
53 #include "webkit/fileapi/file_system_util.h" 54 #include "webkit/fileapi/file_system_util.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 298
298 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, 299 GURL base_url = fileapi::GetFileSystemRootURI(origin_url,
299 fileapi::kFileSystemTypeExternal); 300 fileapi::kFileSystemTypeExternal);
300 *url = GURL(base_url.spec() + virtual_path.value()); 301 *url = GURL(base_url.spec() + virtual_path.value());
301 return true; 302 return true;
302 } 303 }
303 304
304 bool ConvertFileToRelativeFileSystemPath( 305 bool ConvertFileToRelativeFileSystemPath(
305 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { 306 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) {
306 fileapi::ExternalFileSystemMountPointProvider* provider = 307 fileapi::ExternalFileSystemMountPointProvider* provider =
307 BrowserContext::GetFileSystemContext(profile)->external_provider(); 308 BrowserContext::GetDefaultStoragePartition(profile)->
309 GetFileSystemContext()->external_provider();
308 if (!provider) 310 if (!provider)
309 return false; 311 return false;
310 312
311 // Find if this file path is managed by the external provider. 313 // Find if this file path is managed by the external provider.
312 if (!provider->GetVirtualPath(full_file_path, virtual_path)) 314 if (!provider->GetVirtualPath(full_file_path, virtual_path))
313 return false; 315 return false;
314 316
315 return true; 317 return true;
316 } 318 }
317 319
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } else { 558 } else {
557 return ExecuteBuiltinHandler(browser, path, action_id); 559 return ExecuteBuiltinHandler(browser, path, action_id);
558 } 560 }
559 } else { 561 } else {
560 // We are executing the task on behalf of File Browser extension. 562 // We are executing the task on behalf of File Browser extension.
561 const GURL source_url(kBaseFileBrowserUrl); 563 const GURL source_url(kBaseFileBrowserUrl);
562 564
563 // If File Browser has not been open yet then it did not request access 565 // If File Browser has not been open yet then it did not request access
564 // to the file system. Do it now. 566 // to the file system. Do it now.
565 fileapi::ExternalFileSystemMountPointProvider* external_provider = 567 fileapi::ExternalFileSystemMountPointProvider* external_provider =
566 BrowserContext::GetFileSystemContext(profile)->external_provider(); 568 BrowserContext::GetDefaultStoragePartition(
569 profile)->GetFileSystemContext()->external_provider();
567 if (!external_provider) 570 if (!external_provider)
568 return false; 571 return false;
569 external_provider->GrantFullAccessToExtension(source_url.host()); 572 external_provider->GrantFullAccessToExtension(source_url.host());
570 573
571 std::vector<GURL> urls; 574 std::vector<GURL> urls;
572 urls.push_back(url); 575 urls.push_back(url);
573 scoped_refptr<FileTaskExecutor> executor = FileTaskExecutor::Create( 576 scoped_refptr<FileTaskExecutor> executor = FileTaskExecutor::Create(
574 profile, source_url, extension_id, action_id); 577 profile, source_url, extension_id, action_id);
575 executor->Execute(urls); 578 executor->Execute(urls);
576 return true; 579 return true;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 OperationRegistry::ProgressStatus>::const_iterator iter = 781 OperationRegistry::ProgressStatus>::const_iterator iter =
779 list.begin(); 782 list.begin();
780 iter != list.end(); ++iter) { 783 iter != list.end(); ++iter) {
781 result_list->Append( 784 result_list->Append(
782 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); 785 ProgessStatusToDictionaryValue(profile, origin_url, *iter));
783 } 786 }
784 return result_list.release(); 787 return result_list.release();
785 } 788 }
786 789
787 } // namespace file_manager_util 790 } // namespace file_manager_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698