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

Side by Side Diff: chrome/browser/chromeos/drive/drive_protocol_handler.cc

Issue 14755002: drive: Drop "Drive" from FakeDriveFileSystem and MockDriveFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some more cleanup Created 7 years, 7 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/drive/drive_protocol_handler.h" 5 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/drive/drive_system_service.h" 9 #include "chrome/browser/chromeos/drive/drive_system_service.h"
10 #include "chrome/browser/chromeos/drive/drive_url_request_job.h" 10 #include "chrome/browser/chromeos/drive/drive_url_request_job.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 17
18 namespace drive { 18 namespace drive {
19 19
20 namespace { 20 namespace {
21 21
22 // Helper function to get DriveFileSystemInterface from Profile. 22 // Helper function to get DriveFileSystemInterface from Profile.
23 DriveFileSystemInterface* GetDriveFileSystem(void* profile_id) { 23 DriveFileSystemInterface* GetFileSystem(void* profile_id) {
24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
25 25
26 // |profile_id| needs to be checked with ProfileManager::IsValidProfile 26 // |profile_id| needs to be checked with ProfileManager::IsValidProfile
27 // before using it. 27 // before using it.
28 Profile* profile = reinterpret_cast<Profile*>(profile_id); 28 Profile* profile = reinterpret_cast<Profile*>(profile_id);
29 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) 29 if (!g_browser_process->profile_manager()->IsValidProfile(profile))
30 return NULL; 30 return NULL;
31 31
32 DriveSystemService* system_service = 32 DriveSystemService* system_service =
33 DriveSystemServiceFactory::FindForProfile(profile); 33 DriveSystemServiceFactory::FindForProfile(profile);
34 return system_service ? system_service->file_system() : NULL; 34 return system_service ? system_service->file_system() : NULL;
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 DriveProtocolHandler::DriveProtocolHandler(void* profile_id) 39 DriveProtocolHandler::DriveProtocolHandler(void* profile_id)
40 : profile_id_(profile_id) { 40 : profile_id_(profile_id) {
41 } 41 }
42 42
43 DriveProtocolHandler::~DriveProtocolHandler() { 43 DriveProtocolHandler::~DriveProtocolHandler() {
44 } 44 }
45 45
46 net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( 46 net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob(
47 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { 47 net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
48 DVLOG(1) << "Handling url: " << request->url().spec(); 48 DVLOG(1) << "Handling url: " << request->url().spec();
49 return new DriveURLRequestJob( 49 return new DriveURLRequestJob(
50 base::Bind(&GetDriveFileSystem, profile_id_), request, network_delegate); 50 base::Bind(&GetFileSystem, profile_id_), request, network_delegate);
51 } 51 }
52 52
53 } // namespace drive 53 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698