Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / domain_reliability / service.h
blob9625ae633aba5efc3e79f3dfb3653b6c227fad64
1 // Copyright 2014 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.
5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_SERVICE_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_SERVICE_H_
8 #include <string>
10 #include "base/callback_forward.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/single_thread_task_runner.h"
15 #include "components/domain_reliability/clear_mode.h"
16 #include "components/domain_reliability/domain_reliability_export.h"
17 #include "components/keyed_service/core/keyed_service.h"
19 class PrefService;
21 namespace base {
22 class Value;
23 } // namespace base
25 namespace net {
26 class URLRequestContextGetter;
27 } // namespace net
29 namespace domain_reliability {
31 class DomainReliabilityMonitor;
33 // DomainReliabilityService is a KeyedService that manages a Monitor that lives
34 // on another thread (as provided by the URLRequestContextGetter's task runner)
35 // and proxies (selected) method calls to it. Destruction of the Monitor (on
36 // that thread) is the responsibility of the caller.
37 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityService
38 : public KeyedService {
39 public:
40 // Creates a DomainReliabilityService that will contain a Monitor with the
41 // given upload reporter string.
42 static DomainReliabilityService* Create(
43 const std::string& upload_reporter_string);
45 ~DomainReliabilityService() override;
47 // Initializes the Service: given the task runner on which Monitor methods
48 // should be called, creates the Monitor and returns it. Can be called at
49 // most once, and must be called before any of the below methods can be
50 // called. The caller is responsible for destroying the Monitor on the given
51 // task runner when it is no longer needed.
52 virtual scoped_ptr<DomainReliabilityMonitor> CreateMonitor(
53 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) = 0;
55 // Clears browsing data on the associated Monitor. |Init()| must have been
56 // called first.
57 virtual void ClearBrowsingData(DomainReliabilityClearMode clear_mode,
58 const base::Closure& callback) = 0;
60 virtual void GetWebUIData(
61 const base::Callback<void(scoped_ptr<base::Value>)>& callback)
62 const = 0;
64 protected:
65 DomainReliabilityService();
67 private:
68 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityService);
71 } // namespace domain_reliability
73 #endif // COMPONENTS_DOMAIN_RELIABILITY_SERVICE_H_