Ensure low-memory renderers retry failed loads correctly.
[chromium-blink-merge.git] / components / devtools_discovery / devtools_discovery_manager.h
blob45f45d7ec2c110e3937a8ad4a5310586cb39067c
1 // 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.
5 #ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
6 #define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h"
12 #include "components/devtools_discovery/devtools_target_descriptor.h"
14 namespace devtools_discovery {
16 class DevToolsDiscoveryManager {
17 public:
18 class Provider {
19 public:
20 virtual ~Provider() {}
22 // Caller takes ownership of created descriptors.
23 virtual DevToolsTargetDescriptor::List GetDescriptors() = 0;
26 using CreateCallback = base::Callback<
27 scoped_ptr<DevToolsTargetDescriptor>(const GURL& url)>;
29 // Returns single instance of this class. The instance is destroyed on the
30 // browser main loop exit so this method MUST NOT be called after that point.
31 static DevToolsDiscoveryManager* GetInstance();
33 void AddProvider(scoped_ptr<Provider> provider);
34 void SetCreateCallback(const CreateCallback& callback);
36 // Caller takes ownership of created descriptors.
37 DevToolsTargetDescriptor::List GetDescriptors();
38 scoped_ptr<DevToolsTargetDescriptor> CreateNew(const GURL& url);
40 private:
41 friend struct base::DefaultSingletonTraits<DevToolsDiscoveryManager>;
43 DevToolsDiscoveryManager();
44 ~DevToolsDiscoveryManager();
45 DevToolsTargetDescriptor::List GetDescriptorsFromProviders();
47 std::vector<Provider*> providers_;
48 CreateCallback create_callback_;
50 DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager);
53 } // namespace devtools_discovery
55 #endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_