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

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

Issue 10873026: Rename GDataSystemService to DriveSystemService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/gdata_protocol_handler.h" 5 #include "chrome/browser/chromeos/gdata/gdata_protocol_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/chromeos/gdata/drive.pb.h" 20 #include "chrome/browser/chromeos/gdata/drive.pb.h"
21 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" 21 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h"
22 #include "chrome/browser/chromeos/gdata/drive_service_interface.h" 22 #include "chrome/browser/chromeos/gdata/drive_service_interface.h"
23 #include "chrome/browser/chromeos/gdata/drive_system_service.h"
23 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 24 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
24 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
25 #include "chrome/browser/chromeos/gdata/gdata_util.h" 25 #include "chrome/browser/chromeos/gdata/gdata_util.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "content/public/browser/browser_thread.h" 29 #include "content/public/browser/browser_thread.h"
30 #include "net/base/escape.h" 30 #include "net/base/escape.h"
31 #include "net/base/file_stream.h" 31 #include "net/base/file_stream.h"
32 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
33 #include "net/http/http_request_headers.h" 33 #include "net/http/http_request_headers.h"
34 #include "net/http/http_response_headers.h" 34 #include "net/http/http_response_headers.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (!StartsWithASCII(path, drive_schema, false) || 98 if (!StartsWithASCII(path, drive_schema, false) ||
99 path.size() <= drive_schema.size()) { 99 path.size() <= drive_schema.size()) {
100 return false; 100 return false;
101 } 101 }
102 102
103 std::string id = path.substr(drive_schema.size()); 103 std::string id = path.substr(drive_schema.size());
104 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask); 104 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask);
105 return resource_id->size(); 105 return resource_id->size();
106 } 106 }
107 107
108 // Helper function to get GDataSystemService from Profile. 108 // Helper function to get DriveSystemService from Profile.
109 GDataSystemService* GetSystemService() { 109 DriveSystemService* GetSystemService() {
110 return GDataSystemServiceFactory::GetForProfile( 110 return DriveSystemServiceFactory::GetForProfile(
111 ProfileManager::GetDefaultProfile()); 111 ProfileManager::GetDefaultProfile());
112 } 112 }
113 113
114 // Helper function to get DriveFileSystem from Profile on UI thread. 114 // Helper function to get DriveFileSystem from Profile on UI thread.
115 void GetFileSystemOnUIThread(DriveFileSystemInterface** file_system) { 115 void GetFileSystemOnUIThread(DriveFileSystemInterface** file_system) {
116 GDataSystemService* system_service = GetSystemService(); 116 DriveSystemService* system_service = GetSystemService();
117 *file_system = system_service ? system_service->file_system() : NULL; 117 *file_system = system_service ? system_service->file_system() : NULL;
118 } 118 }
119 119
120 // Helper function to cancel GData download operation on UI thread. 120 // Helper function to cancel GData download operation on UI thread.
121 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) { 121 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) {
122 GDataSystemService* system_service = GetSystemService(); 122 DriveSystemService* system_service = GetSystemService();
123 if (system_service) 123 if (system_service)
124 system_service->drive_service()->operation_registry()->CancelForFilePath( 124 system_service->drive_service()->operation_registry()->CancelForFilePath(
125 gdata_file_path); 125 gdata_file_path);
126 } 126 }
127 127
128 // GDataURLRequesetJob is the gateway between network-level drive://... 128 // GDataURLRequesetJob is the gateway between network-level drive://...
129 // requests for gdata resources and GDataFileSytem. It exposes content URLs 129 // requests for gdata resources and GDataFileSytem. It exposes content URLs
130 // formatted as drive://<resource-id>. 130 // formatted as drive://<resource-id>.
131 class GDataURLRequestJob : public net::URLRequestJob { 131 class GDataURLRequestJob : public net::URLRequestJob {
132 public: 132 public:
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 GDataProtocolHandler::~GDataProtocolHandler() { 933 GDataProtocolHandler::~GDataProtocolHandler() {
934 } 934 }
935 935
936 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( 936 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob(
937 net::URLRequest* request) const { 937 net::URLRequest* request) const {
938 DVLOG(1) << "Handling url: " << request->url().spec(); 938 DVLOG(1) << "Handling url: " << request->url().spec();
939 return new GDataURLRequestJob(request); 939 return new GDataURLRequestJob(request);
940 } 940 }
941 941
942 } // namespace gdata 942 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698