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

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: Fix merge issue, remove one include header which is no longer necessary 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 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (!StartsWithASCII(path, drive_schema, false) || 97 if (!StartsWithASCII(path, drive_schema, false) ||
98 path.size() <= drive_schema.size()) { 98 path.size() <= drive_schema.size()) {
99 return false; 99 return false;
100 } 100 }
101 101
102 std::string id = path.substr(drive_schema.size()); 102 std::string id = path.substr(drive_schema.size());
103 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask); 103 *resource_id = net::UnescapeURLComponent(id, kUrlPathUnescapeMask);
104 return resource_id->size(); 104 return resource_id->size();
105 } 105 }
106 106
107 // Helper function to get GDataSystemService from Profile. 107 // Helper function to get DriveSystemService from Profile.
108 GDataSystemService* GetSystemService() { 108 DriveSystemService* GetSystemService() {
109 return GDataSystemServiceFactory::GetForProfile( 109 return DriveSystemServiceFactory::GetForProfile(
110 ProfileManager::GetDefaultProfile()); 110 ProfileManager::GetDefaultProfile());
111 } 111 }
112 112
113 // Helper function to get DriveFileSystem from Profile on UI thread. 113 // Helper function to get DriveFileSystem from Profile on UI thread.
114 void GetFileSystemOnUIThread(DriveFileSystemInterface** file_system) { 114 void GetFileSystemOnUIThread(DriveFileSystemInterface** file_system) {
115 GDataSystemService* system_service = GetSystemService(); 115 DriveSystemService* system_service = GetSystemService();
116 *file_system = system_service ? system_service->file_system() : NULL; 116 *file_system = system_service ? system_service->file_system() : NULL;
117 } 117 }
118 118
119 // Helper function to cancel GData download operation on UI thread. 119 // Helper function to cancel GData download operation on UI thread.
120 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) { 120 void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) {
121 GDataSystemService* system_service = GetSystemService(); 121 DriveSystemService* system_service = GetSystemService();
122 if (system_service) 122 if (system_service)
123 system_service->drive_service()->operation_registry()->CancelForFilePath( 123 system_service->drive_service()->operation_registry()->CancelForFilePath(
124 gdata_file_path); 124 gdata_file_path);
125 } 125 }
126 126
127 // GDataURLRequesetJob is the gateway between network-level drive://... 127 // GDataURLRequesetJob is the gateway between network-level drive://...
128 // requests for gdata resources and GDataFileSytem. It exposes content URLs 128 // requests for gdata resources and GDataFileSytem. It exposes content URLs
129 // formatted as drive://<resource-id>. 129 // formatted as drive://<resource-id>.
130 class GDataURLRequestJob : public net::URLRequestJob { 130 class GDataURLRequestJob : public net::URLRequestJob {
131 public: 131 public:
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 GDataProtocolHandler::~GDataProtocolHandler() { 934 GDataProtocolHandler::~GDataProtocolHandler() {
935 } 935 }
936 936
937 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob( 937 net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob(
938 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { 938 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
939 DVLOG(1) << "Handling url: " << request->url().spec(); 939 DVLOG(1) << "Handling url: " << request->url().spec();
940 return new GDataURLRequestJob(request, network_delegate); 940 return new GDataURLRequestJob(request, network_delegate);
941 } 941 }
942 942
943 } // namespace gdata 943 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_download_observer.cc ('k') | chrome/browser/chromeos/gdata/gdata_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698