Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / drive / drive_protocol_handler.cc
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h"
6
7 #include "base/logging.h"
8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/browser/chromeos/drive/drive_url_request_job.h"
10 #include "chrome/browser/chromeos/drive/file_system_util.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "net/url_request/url_request.h"
13 #include "url/gurl.h"
14
15 using content::BrowserThread;
16
17 namespace drive {
18
19 DriveProtocolHandler::DriveProtocolHandler(void* profile_id)
20     : profile_id_(profile_id) {
21   scoped_refptr<base::SequencedWorkerPool> blocking_pool =
22       BrowserThread::GetBlockingPool();
23   blocking_task_runner_ =
24       blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken());
25 }
26
27 DriveProtocolHandler::~DriveProtocolHandler() {
28 }
29
30 net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob(
31     net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
32   DVLOG(1) << "Handling url: " << request->url().spec();
33   return new DriveURLRequestJob(
34       base::Bind(&util::GetFileSystemByProfileId, profile_id_),
35       blocking_task_runner_.get(),
36       request,
37       network_delegate);
38 }
39
40 }  // namespace drive