Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: components/devtools_discovery/devtools_discovery_manager.h

Issue 2119063002: Add commands to manage tabs and contexts to Browser Domain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a check to prevent Browser.closeContext from closing a context that is in use. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 5 #ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
6 #define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 6 #define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/values.h"
13 #include "components/devtools_discovery/devtools_target_descriptor.h" 14 #include "components/devtools_discovery/devtools_target_descriptor.h"
14 15
15 namespace devtools_discovery { 16 namespace devtools_discovery {
16 17
17 class DevToolsDiscoveryManager { 18 class DevToolsDiscoveryManager {
18 public: 19 public:
19 class Provider { 20 class Provider {
20 public: 21 public:
21 virtual ~Provider() {} 22 virtual ~Provider() {}
22 23
23 // Caller takes ownership of created descriptors. 24 // Caller takes ownership of created descriptors.
24 virtual DevToolsTargetDescriptor::List GetDescriptors() = 0; 25 virtual DevToolsTargetDescriptor::List GetDescriptors() = 0;
25 }; 26 };
26 27
27 using CreateCallback = 28 using CreateCallback =
28 base::Callback<std::unique_ptr<DevToolsTargetDescriptor>( 29 base::Callback<std::unique_ptr<DevToolsTargetDescriptor>(
29 const GURL& url)>; 30 const GURL& url)>;
30 31
31 // Returns single instance of this class. The instance is destroyed on the 32 // Returns single instance of this class. The instance is destroyed on the
32 // browser main loop exit so this method MUST NOT be called after that point. 33 // browser main loop exit so this method MUST NOT be called after that point.
33 static DevToolsDiscoveryManager* GetInstance(); 34 static DevToolsDiscoveryManager* GetInstance();
34 35
35 void AddProvider(std::unique_ptr<Provider> provider); 36 void AddProvider(std::unique_ptr<Provider> provider);
36 void SetCreateCallback(const CreateCallback& callback); 37 void SetCreateCallback(const CreateCallback& callback);
37 38
38 // Caller takes ownership of created descriptors. 39 // Caller takes ownership of created descriptors.
39 DevToolsTargetDescriptor::List GetDescriptors(); 40 DevToolsTargetDescriptor::List GetDescriptors();
40 std::unique_ptr<DevToolsTargetDescriptor> CreateNew(const GURL& url); 41 std::unique_ptr<DevToolsTargetDescriptor> CreateNew(const GURL& url);
41 42
43 // Handles Browser.newPage only.
44 base::DictionaryValue* MaybeHandleNewPageCommand(
Sami 2016/07/04 15:28:54 unique_ptr<base::DictionaryValue> to pass ownershi
alex clarke (OOO till 29th) 2016/07/04 16:33:59 Done.
45 base::DictionaryValue* command_dict);
46
42 private: 47 private:
43 friend struct base::DefaultSingletonTraits<DevToolsDiscoveryManager>; 48 friend struct base::DefaultSingletonTraits<DevToolsDiscoveryManager>;
44 49
45 DevToolsDiscoveryManager(); 50 DevToolsDiscoveryManager();
46 ~DevToolsDiscoveryManager(); 51 ~DevToolsDiscoveryManager();
47 DevToolsTargetDescriptor::List GetDescriptorsFromProviders(); 52 DevToolsTargetDescriptor::List GetDescriptorsFromProviders();
48 53
49 std::vector<Provider*> providers_; 54 std::vector<Provider*> providers_;
50 CreateCallback create_callback_; 55 CreateCallback create_callback_;
51 56
52 DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager); 57 DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager);
53 }; 58 };
54 59
55 } // namespace devtools_discovery 60 } // namespace devtools_discovery
56 61
57 #endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 62 #endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698