| OLD | NEW |
| 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 #include "components/devtools_discovery/basic_target_descriptor.h" | 5 #include "components/devtools_discovery/basic_target_descriptor.h" |
| 6 | 6 |
| 7 #include "content/public/browser/devtools_agent_host.h" | 7 #include "content/public/browser/devtools_agent_host.h" |
| 8 #include "content/public/browser/favicon_status.h" | 8 #include "content/public/browser/favicon_status.h" |
| 9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 scoped_refptr<DevToolsAgentHost> agent_host) | 40 scoped_refptr<DevToolsAgentHost> agent_host) |
| 41 : agent_host_(agent_host), | 41 : agent_host_(agent_host), |
| 42 type_(GetTypeFromAgentHost(agent_host.get())), | 42 type_(GetTypeFromAgentHost(agent_host.get())), |
| 43 title_(agent_host->GetTitle()), | 43 title_(agent_host->GetTitle()), |
| 44 url_(agent_host->GetURL()) { | 44 url_(agent_host->GetURL()) { |
| 45 if (content::WebContents* web_contents = agent_host_->GetWebContents()) { | 45 if (content::WebContents* web_contents = agent_host_->GetWebContents()) { |
| 46 content::NavigationController& controller = web_contents->GetController(); | 46 content::NavigationController& controller = web_contents->GetController(); |
| 47 content::NavigationEntry* entry = controller.GetActiveEntry(); | 47 content::NavigationEntry* entry = controller.GetActiveEntry(); |
| 48 if (entry != NULL && entry->GetURL().is_valid()) | 48 if (entry != NULL && entry->GetURL().is_valid()) |
| 49 favicon_url_ = entry->GetFavicon().url; | 49 favicon_url_ = entry->GetFavicon().url; |
| 50 last_active_time_ = web_contents->GetLastActiveTime(); | 50 last_activity_time_ = web_contents->GetLastActiveTime(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 BasicTargetDescriptor::~BasicTargetDescriptor() { | 54 BasicTargetDescriptor::~BasicTargetDescriptor() { |
| 55 } | 55 } |
| 56 | 56 |
| 57 std::string BasicTargetDescriptor::GetId() const { | 57 std::string BasicTargetDescriptor::GetId() const { |
| 58 return agent_host_->GetId(); | 58 return agent_host_->GetId(); |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 GURL BasicTargetDescriptor::GetURL() const { | 77 GURL BasicTargetDescriptor::GetURL() const { |
| 78 return url_; | 78 return url_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 GURL BasicTargetDescriptor::GetFaviconURL() const { | 81 GURL BasicTargetDescriptor::GetFaviconURL() const { |
| 82 return favicon_url_; | 82 return favicon_url_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 base::Time BasicTargetDescriptor::GetLastActiveTime() const { | 85 base::TimeTicks BasicTargetDescriptor::GetLastActivityTime() const { |
| 86 return last_active_time_; | 86 return last_activity_time_; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool BasicTargetDescriptor::IsAttached() const { | 89 bool BasicTargetDescriptor::IsAttached() const { |
| 90 return agent_host_->IsAttached(); | 90 return agent_host_->IsAttached(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 scoped_refptr<DevToolsAgentHost> BasicTargetDescriptor::GetAgentHost() const { | 93 scoped_refptr<DevToolsAgentHost> BasicTargetDescriptor::GetAgentHost() const { |
| 94 return agent_host_; | 94 return agent_host_; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool BasicTargetDescriptor::Activate() const { | 97 bool BasicTargetDescriptor::Activate() const { |
| 98 return agent_host_->Activate(); | 98 return agent_host_->Activate(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool BasicTargetDescriptor::Close() const { | 101 bool BasicTargetDescriptor::Close() const { |
| 102 return agent_host_->Close(); | 102 return agent_host_->Close(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace devtools_discovery | 105 } // namespace devtools_discovery |
| OLD | NEW |