blob: 52d4e144c0f3f3e894806623559eb650b4d9414b [file] [log] [blame]
Benjamin Lerman5d429aa2015-05-07 16:21:00 +02001// Copyright 2015 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#ifndef SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_APP_H_
6#define SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_APP_H_
7
8#include "base/macros.h"
Benjamin Lermand15e3f42015-09-17 11:26:18 +02009#include "base/memory/ref_counted.h"
Benjamin Lermana9579a92015-07-28 10:30:26 +020010#include "base/task_runner.h"
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020011#include "base/threading/sequenced_worker_pool.h"
12#include "mojo/public/cpp/application/application_connection.h"
13#include "mojo/public/cpp/application/application_delegate.h"
Przemyslaw Pietrzkiewicz9f2c1522015-09-01 18:40:14 +020014#include "mojo/public/cpp/application/application_impl.h"
Viet-Trung Luu0f4f3ba2015-10-10 01:08:40 -070015#include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cache.mojom.h"
Benjamin Lermand15e3f42015-09-17 11:26:18 +020016#include "services/url_response_disk_cache/url_response_disk_cache_db.h"
Benjamin Lermanc440c742015-09-28 13:52:53 +020017#include "services/url_response_disk_cache/url_response_disk_cache_delegate.h"
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020018
19namespace mojo {
20
Viet-Trung Luu5e30a072016-05-13 14:12:59 -070021class URLResponseDiskCacheApp : public ApplicationDelegate {
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020022 public:
Benjamin Lermanc440c742015-09-28 13:52:53 +020023 explicit URLResponseDiskCacheApp(scoped_refptr<base::TaskRunner> task_runner,
24 URLResponseDiskCacheDelegate* delegate);
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020025 ~URLResponseDiskCacheApp() override;
26
27 private:
Przemyslaw Pietrzkiewicz9f2c1522015-09-01 18:40:14 +020028 // ApplicationDelegate:
29 void Initialize(ApplicationImpl* app) override;
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020030 bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
31
Benjamin Lermand15e3f42015-09-17 11:26:18 +020032 scoped_refptr<base::TaskRunner> task_runner_;
33 scoped_refptr<URLResponseDiskCacheDB> db_;
Benjamin Lermanc440c742015-09-28 13:52:53 +020034 URLResponseDiskCacheDelegate* delegate_;
Benjamin Lerman5d429aa2015-05-07 16:21:00 +020035
36 DISALLOW_COPY_AND_ASSIGN(URLResponseDiskCacheApp);
37};
38
39} // namespace mojo
40
41#endif // SERVICES_URL_RESPONSE_DISK_CACHE_URL_RESPONSE_DISK_CACHE_APP_H_