1 // Copyright 2013 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 CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "base/memory/ref_counted.h" 12 #include "base/time/time.h" 13 #include "content/common/content_export.h" 14 #include "url/gurl.h" 15 16 namespace content { 17 18 class DevToolsAgentHost; 19 20 // DevToolsTarget represents an inspectable target and can be used to 21 // manipulate the target and query its details. 22 // Instantiation and discovery of DevToolsTarget instances is the responsibility 23 // of DevToolsHttpHandlerDelegate. 24 class DevToolsTarget { 25 public: ~DevToolsTarget()26 virtual ~DevToolsTarget() {} 27 28 // Returns the unique target id. 29 virtual std::string GetId() const = 0; 30 31 // Returns the id of the parent target, or empty string if no parent. 32 virtual std::string GetParentId() const = 0; 33 34 // Returns the target type. 35 virtual std::string GetType() const = 0; 36 37 // Returns the target title. 38 virtual std::string GetTitle() const = 0; 39 40 // Returns the target description. 41 virtual std::string GetDescription() const = 0; 42 43 // Returns the url associated with this target. 44 virtual GURL GetURL() const = 0; 45 46 // Returns the favicon url for this target. 47 virtual GURL GetFaviconURL() const = 0; 48 49 // Returns the time when the target was last active. 50 virtual base::TimeTicks GetLastActivityTime() const = 0; 51 52 // Returns true if the debugger is attached to the target. 53 virtual bool IsAttached() const = 0; 54 55 // Returns the agent host for this target. 56 virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const = 0; 57 58 // Activates the target. Returns false if the operation failed. 59 virtual bool Activate() const = 0; 60 61 // Closes the target. Returns false if the operation failed. 62 virtual bool Close() const = 0; 63 }; 64 65 } // namespace content 66 67 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 68