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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_task_executor.cc

Issue 10823273: Integrate external mount points to IsolatedContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove too strict DCHECK Created 8 years, 4 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/chromeos/gdata/drive_task_executor.h" 5 #include "chrome/browser/chromeos/gdata/drive_task_executor.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" 12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h"
13 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 13 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
15 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 15 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_tabstrip.h" 20 #include "chrome/browser/ui/browser_tabstrip.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "webkit/fileapi/file_system_types.h" 23 #include "webkit/fileapi/file_system_types.h"
24 #include "webkit/fileapi/file_system_url.h"
24 #include "webkit/fileapi/file_system_util.h" 25 #include "webkit/fileapi/file_system_util.h"
25 26
26 namespace gdata { 27 namespace gdata {
27 28
28 using file_handler_util::FileTaskExecutor; 29 using file_handler_util::FileTaskExecutor;
29 30
30 DriveTaskExecutor::DriveTaskExecutor(Profile* profile, 31 DriveTaskExecutor::DriveTaskExecutor(Profile* profile,
31 const std::string& app_id, 32 const std::string& app_id,
32 const std::string& action_id) 33 const std::string& action_id)
33 : file_handler_util::FileTaskExecutor(profile), 34 : file_handler_util::FileTaskExecutor(profile),
(...skipping 11 matching lines...) Expand all
45 46
46 DriveTaskExecutor::~DriveTaskExecutor() { 47 DriveTaskExecutor::~DriveTaskExecutor() {
47 } 48 }
48 49
49 bool DriveTaskExecutor::ExecuteAndNotify( 50 bool DriveTaskExecutor::ExecuteAndNotify(
50 const std::vector<GURL>& file_urls, 51 const std::vector<GURL>& file_urls,
51 const file_handler_util::FileTaskFinishedCallback& done) { 52 const file_handler_util::FileTaskFinishedCallback& done) {
52 std::vector<FilePath> raw_paths; 53 std::vector<FilePath> raw_paths;
53 for (std::vector<GURL>::const_iterator iter = file_urls.begin(); 54 for (std::vector<GURL>::const_iterator iter = file_urls.begin();
54 iter != file_urls.end(); ++iter) { 55 iter != file_urls.end(); ++iter) {
55 FilePath raw_path; 56 fileapi::FileSystemURL url(*iter);
56 fileapi::FileSystemType type = fileapi::kFileSystemTypeUnknown; 57 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive)
57 if (!fileapi::CrackFileSystemURL(*iter, NULL, &type, &raw_path) ||
58 type != fileapi::kFileSystemTypeExternal) {
59 return false; 58 return false;
60 } 59 raw_paths.push_back(url.virtual_path());
61 raw_paths.push_back(raw_path);
62 } 60 }
63 61
64 gdata::GDataSystemService* system_service = 62 gdata::GDataSystemService* system_service =
65 gdata::GDataSystemServiceFactory::GetForProfile(profile()); 63 gdata::GDataSystemServiceFactory::GetForProfile(profile());
66 DCHECK(current_index_ == 0); 64 DCHECK(current_index_ == 0);
67 if (!system_service || !system_service->file_system()) 65 if (!system_service || !system_service->file_system())
68 return false; 66 return false;
69 gdata::GDataFileSystemInterface* file_system = system_service->file_system(); 67 gdata::GDataFileSystemInterface* file_system = system_service->file_system();
70 68
71 // Reset the index, so we know when we're done. 69 // Reset the index, so we know when we're done.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 167
170 void DriveTaskExecutor::Done(bool success) { 168 void DriveTaskExecutor::Done(bool success) {
171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 169 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
172 current_index_ = 0; 170 current_index_ = 0;
173 if (!done_.is_null()) 171 if (!done_.is_null())
174 done_.Run(success); 172 done_.Run(success);
175 done_.Reset(); 173 done_.Reset();
176 } 174 }
177 175
178 } // namespace gdata 176 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_handler_util.cc ('k') | chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698