14e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 24e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 34e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// found in the LICENSE file. 44e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 54e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 64e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include <string> 94e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "base/basictypes.h" 114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "base/memory/ref_counted.h" 124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "base/time/time.h" 134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "content/common/content_export.h" 144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "url/gurl.h" 154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace content { 174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class DevToolsAgentHost; 194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// DevToolsTarget represents an inspectable target and can be used to 214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// manipulate the target and query its details. 224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Instantiation and discovery of DevToolsTarget instances is the responsibility 234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// of DevToolsHttpHandlerDelegate. 244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class DevToolsTarget { 254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) public: 264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual ~DevToolsTarget() {} 274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the unique target id. 294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual std::string GetId() const = 0; 304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 3146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // Returns the id of the parent target, or empty string if no parent. 3246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) virtual std::string GetParentId() const = 0; 3346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) 344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the target type. 354e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual std::string GetType() const = 0; 364e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the target title. 384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual std::string GetTitle() const = 0; 394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 404e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the target description. 414e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual std::string GetDescription() const = 0; 424e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the url associated with this target. 44010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) virtual GURL GetURL() const = 0; 454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the favicon url for this target. 47010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) virtual GURL GetFaviconURL() const = 0; 484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 494e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the time when the target was last active. 504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual base::TimeTicks GetLastActivityTime() const = 0; 514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns true if the debugger is attached to the target. 534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual bool IsAttached() const = 0; 544e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 554e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns the agent host for this target. 564e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const = 0; 574e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 584e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Activates the target. Returns false if the operation failed. 594e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual bool Activate() const = 0; 604e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 614e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Closes the target. Returns false if the operation failed. 624e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual bool Close() const = 0; 634e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}; 644e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 654e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} // namespace content 664e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 674e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_H_ 68