| OLD | NEW |
| 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_protocol_handler.h" | 5 #include "chrome/browser/chromeos/gdata/drive_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 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DriveSystemService* 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 Drive download operation on UI thread. | 119 // Helper function to cancel Drive download operation on UI thread. |
| 120 void CancelDriveDownloadOnUIThread(const FilePath& drive_file_path) { | 120 void CancelDriveDownloadOnUIThread(const FilePath& drive_file_path) { |
| 121 DriveSystemService* 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()->CancelForFilePath(drive_file_path); |
| 124 drive_file_path); | |
| 125 } | 124 } |
| 126 | 125 |
| 127 // DriveURLRequesetJob is the gateway between network-level drive://... | 126 // DriveURLRequesetJob is the gateway between network-level drive://... |
| 128 // requests for drive resources and DriveFileSytem. It exposes content URLs | 127 // requests for drive resources and DriveFileSytem. It exposes content URLs |
| 129 // formatted as drive://<resource-id>. | 128 // formatted as drive://<resource-id>. |
| 130 class DriveURLRequestJob : public net::URLRequestJob { | 129 class DriveURLRequestJob : public net::URLRequestJob { |
| 131 public: | 130 public: |
| 132 DriveURLRequestJob(net::URLRequest* request, | 131 DriveURLRequestJob(net::URLRequest* request, |
| 133 net::NetworkDelegate* network_delegate); | 132 net::NetworkDelegate* network_delegate); |
| 134 | 133 |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 DriveProtocolHandler::~DriveProtocolHandler() { | 934 DriveProtocolHandler::~DriveProtocolHandler() { |
| 936 } | 935 } |
| 937 | 936 |
| 938 net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( | 937 net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( |
| 939 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 938 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| 940 DVLOG(1) << "Handling url: " << request->url().spec(); | 939 DVLOG(1) << "Handling url: " << request->url().spec(); |
| 941 return new DriveURLRequestJob(request, network_delegate); | 940 return new DriveURLRequestJob(request, network_delegate); |
| 942 } | 941 } |
| 943 | 942 |
| 944 } // namespace gdata | 943 } // namespace gdata |
| OLD | NEW |