summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/drive/drive_protocol_handler.h
blob: 9c1c796eb7db85fb309db3d3af41c0b7064dcc46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PROTOCOL_HANDLER_H_
#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PROTOCOL_HANDLER_H_

#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "net/url_request/url_request_job_factory.h"

namespace base {
class SequencedTaskRunner;
}  // namespace base

namespace drive {

class DriveProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
 public:
  explicit DriveProtocolHandler(void* profile_id);
  virtual ~DriveProtocolHandler();

  // Creates URLRequestJobs for drive:// URLs.
  virtual net::URLRequestJob* MaybeCreateJob(
      net::URLRequest* request,
      net::NetworkDelegate* network_delegate) const OVERRIDE;

 private:
  // The profile for processing Drive accesses. Should not be NULL.
  void* profile_id_;

  // The task runner for operations to communicate with a locally cached file.
  scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;

  DISALLOW_COPY_AND_ASSIGN(DriveProtocolHandler);
};

}  // namespace drive

#endif  // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_PROTOCOL_HANDLER_H_