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

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

Issue 10533042: Remove chromeos::GDataFileSystem::GetOperationRegistry() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove include Created 8 years, 6 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/gdata_protocol_handler.h" 5 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 19 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
20 #include "chrome/browser/chromeos/gdata/gdata_files.h" 20 #include "chrome/browser/chromeos/gdata/gdata_files.h"
21 #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h"
21 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 22 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
22 #include "chrome/browser/chromeos/gdata/gdata_util.h" 23 #include "chrome/browser/chromeos/gdata/gdata_util.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "net/base/escape.h" 28 #include "net/base/escape.h"
28 #include "net/base/file_stream.h" 29 #include "net/base/file_stream.h"
29 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
30 #include "net/http/http_request_headers.h" 31 #include "net/http/http_request_headers.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return false; 78 return false;
78 } 79 }
79 80
80 std::string id = path.substr(drive_schema.size()); 81 std::string id = path.substr(drive_schema.size());
81 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask); 82 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask);
82 return resource_id->size(); 83 return resource_id->size();
83 } 84 }
84 85
85 } // namespace 86 } // namespace
86 87
88 // Helper function to get GDataSystemService from Profile.
achuithb 2012/06/07 09:55:39 Any reason why this is not in the anonymous namesp
hashimoto 2012/06/07 10:11:57 Oops, done
achuithb 2012/06/07 10:24:43 Is it possible to also move all the other function
hashimoto 2012/06/07 16:16:21 Done.
89 GDataSystemService* GetSystemService() {
90 return GDataSystemServiceFactory::GetForProfile(
91 ProfileManager::GetDefaultProfile());
92 }
93
87 // Helper function to get GDataFileSystem from Profile on UI thread. 94 // Helper function to get GDataFileSystem from Profile on UI thread.
88 void GetFileSystemOnUIThread(GDataFileSystem** file_system) { 95 void GetFileSystemOnUIThread(GDataFileSystem** file_system) {
89 GDataSystemService* system_service = GDataSystemServiceFactory::GetForProfile( 96 GDataSystemService* system_service = GetSystemService();
90 ProfileManager::GetDefaultProfile());
91 *file_system = system_service ? system_service->file_system() : NULL; 97 *file_system = system_service ? system_service->file_system() : NULL;
92 } 98 }
93 99
94 // Helper function to cancel GData download operation on UI thread. 100 // Helper function to cancel GData download operation on UI thread.
95 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) { 101 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) {
96 GDataFileSystem* file_system = NULL; 102 GDataSystemService* system_service = GetSystemService();
97 GetFileSystemOnUIThread(&file_system); 103 if (system_service)
98 if (file_system) 104 system_service->docs_service()->operation_registry()->CancelForFilePath(
99 file_system->GetOperationRegistry()->CancelForFilePath(gdata_file_path); 105 gdata_file_path);
100 } 106 }
101 107
102 // GDataURLRequesetJob is the gateway between network-level drive://... 108 // GDataURLRequesetJob is the gateway between network-level drive://...
103 // requests for gdata resources and GDataFileSytem. It exposes content URLs 109 // requests for gdata resources and GDataFileSytem. It exposes content URLs
104 // formatted as drive://<resource-id>. 110 // formatted as drive://<resource-id>.
105 class GDataURLRequestJob : public net::URLRequestJob { 111 class GDataURLRequestJob : public net::URLRequestJob {
106 public: 112 public:
107 explicit GDataURLRequestJob(net::URLRequest* request); 113 explicit GDataURLRequestJob(net::URLRequest* request);
108 virtual ~GDataURLRequestJob(); 114 virtual ~GDataURLRequestJob();
109 115
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 GDataProtocolHandler::~GDataProtocolHandler() { 905 GDataProtocolHandler::~GDataProtocolHandler() {
900 } 906 }
901 907
902 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( 908 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob(
903 net::URLRequest* request) const { 909 net::URLRequest* request) const {
904 DVLOG(1) << "Handling url: " << request->url().spec(); 910 DVLOG(1) << "Handling url: " << request->url().spec();
905 return new GDataURLRequestJob(request); 911 return new GDataURLRequestJob(request);
906 } 912 }
907 913
908 } // namespace gdata 914 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.cc ('k') | chrome/browser/chromeos/system/ash_system_tray_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698