| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "android_webview/browser/aw_dev_tools_manager_delegate.h" | 5 #include "android_webview/browser/aw_dev_tools_manager_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/native/aw_contents.h" | 7 #include "android_webview/native/aw_contents.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char kTargetTypePage[] = "page"; | 23 const char kTargetTypePage[] = "page"; |
| 24 const char kTargetTypeServiceWorker[] = "service_worker"; | 24 const char kTargetTypeServiceWorker[] = "service_worker"; |
| 25 const char kTargetTypeOther[] = "other"; | 25 const char kTargetTypeOther[] = "other"; |
| 26 | 26 |
| 27 std::string GetViewDescription(WebContents* web_contents); | 27 std::string GetViewDescription(WebContents* web_contents); |
| 28 | 28 |
| 29 class Target : public content::DevToolsTarget { | 29 class Target : public content::DevToolsTarget { |
| 30 public: | 30 public: |
| 31 explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); | 31 explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); |
| 32 | 32 |
| 33 virtual std::string GetId() const OVERRIDE { return agent_host_->GetId(); } | 33 virtual std::string GetId() const override { return agent_host_->GetId(); } |
| 34 virtual std::string GetParentId() const OVERRIDE { return std::string(); } | 34 virtual std::string GetParentId() const override { return std::string(); } |
| 35 virtual std::string GetType() const OVERRIDE { | 35 virtual std::string GetType() const override { |
| 36 switch (agent_host_->GetType()) { | 36 switch (agent_host_->GetType()) { |
| 37 case DevToolsAgentHost::TYPE_WEB_CONTENTS: | 37 case DevToolsAgentHost::TYPE_WEB_CONTENTS: |
| 38 return kTargetTypePage; | 38 return kTargetTypePage; |
| 39 case DevToolsAgentHost::TYPE_SERVICE_WORKER: | 39 case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
| 40 return kTargetTypeServiceWorker; | 40 return kTargetTypeServiceWorker; |
| 41 default: | 41 default: |
| 42 break; | 42 break; |
| 43 } | 43 } |
| 44 return kTargetTypeOther; | 44 return kTargetTypeOther; |
| 45 } | 45 } |
| 46 virtual std::string GetTitle() const OVERRIDE { | 46 virtual std::string GetTitle() const override { |
| 47 return agent_host_->GetTitle(); | 47 return agent_host_->GetTitle(); |
| 48 } | 48 } |
| 49 virtual std::string GetDescription() const OVERRIDE { return description_; } | 49 virtual std::string GetDescription() const override { return description_; } |
| 50 virtual GURL GetURL() const OVERRIDE { return agent_host_->GetURL(); } | 50 virtual GURL GetURL() const override { return agent_host_->GetURL(); } |
| 51 virtual GURL GetFaviconURL() const OVERRIDE { return GURL(); } | 51 virtual GURL GetFaviconURL() const override { return GURL(); } |
| 52 virtual base::TimeTicks GetLastActivityTime() const OVERRIDE { | 52 virtual base::TimeTicks GetLastActivityTime() const override { |
| 53 return last_activity_time_; | 53 return last_activity_time_; |
| 54 } | 54 } |
| 55 virtual bool IsAttached() const OVERRIDE { | 55 virtual bool IsAttached() const override { |
| 56 return agent_host_->IsAttached(); | 56 return agent_host_->IsAttached(); |
| 57 } | 57 } |
| 58 virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE { | 58 virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { |
| 59 return agent_host_; | 59 return agent_host_; |
| 60 } | 60 } |
| 61 virtual bool Activate() const OVERRIDE { return agent_host_->Activate(); } | 61 virtual bool Activate() const override { return agent_host_->Activate(); } |
| 62 virtual bool Close() const OVERRIDE { return agent_host_->Close(); } | 62 virtual bool Close() const override { return agent_host_->Close(); } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 scoped_refptr<DevToolsAgentHost> agent_host_; | 65 scoped_refptr<DevToolsAgentHost> agent_host_; |
| 66 std::string description_; | 66 std::string description_; |
| 67 base::TimeTicks last_activity_time_; | 67 base::TimeTicks last_activity_time_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) | 70 Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) |
| 71 : agent_host_(agent_host) { | 71 : agent_host_(agent_host) { |
| 72 if (WebContents* web_contents = agent_host->GetWebContents()) { | 72 if (WebContents* web_contents = agent_host->GetWebContents()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 std::string AwDevToolsManagerDelegate::GetPageThumbnailData(const GURL&) { | 125 std::string AwDevToolsManagerDelegate::GetPageThumbnailData(const GURL&) { |
| 126 return ""; | 126 return ""; |
| 127 } | 127 } |
| 128 | 128 |
| 129 scoped_ptr<content::DevToolsTarget> AwDevToolsManagerDelegate::CreateNewTarget( | 129 scoped_ptr<content::DevToolsTarget> AwDevToolsManagerDelegate::CreateNewTarget( |
| 130 const GURL&) { | 130 const GURL&) { |
| 131 return scoped_ptr<content::DevToolsTarget>(); | 131 return scoped_ptr<content::DevToolsTarget>(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace android_webview | 134 } // namespace android_webview |
| OLD | NEW |