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

Side by Side Diff: chrome/browser/devtools/device/devtools_device_discovery.cc

Issue 2678783005: DevTools: return remote debugging targets sorted by last active time (as it was long ago). (Closed)
Patch Set: Created 3 years, 10 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 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 "chrome/browser/devtools/device/devtools_device_discovery.h" 5 #include "chrome/browser/devtools/device/devtools_device_discovery.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void Detach() override; 131 void Detach() override;
132 std::string GetType() override; 132 std::string GetType() override;
133 std::string GetTitle() override; 133 std::string GetTitle() override;
134 std::string GetDescription() override; 134 std::string GetDescription() override;
135 GURL GetURL() override; 135 GURL GetURL() override;
136 GURL GetFaviconURL() override; 136 GURL GetFaviconURL() override;
137 std::string GetFrontendURL() override; 137 std::string GetFrontendURL() override;
138 bool Activate() override; 138 bool Activate() override;
139 void Reload() override; 139 void Reload() override;
140 bool Close() override; 140 bool Close() override;
141 base::TimeTicks GetLastActivityTime() override;
141 void SendMessageToBackend(const std::string& message) override; 142 void SendMessageToBackend(const std::string& message) override;
142 143
143 void OnSocketOpened() override; 144 void OnSocketOpened() override;
144 void OnFrameRead(const std::string& message) override; 145 void OnFrameRead(const std::string& message) override;
145 void OnSocketClosed() override; 146 void OnSocketClosed() override;
146 147
147 void SendProtocolCommand(const std::string& target_path, 148 void SendProtocolCommand(const std::string& target_path,
148 const std::string& method, 149 const std::string& method,
149 std::unique_ptr<base::DictionaryValue> params, 150 std::unique_ptr<base::DictionaryValue> params,
150 const base::Closure callback); 151 const base::Closure callback);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 base::Closure()); 310 base::Closure());
310 } 311 }
311 312
312 bool AgentHostDelegate::Close() { 313 bool AgentHostDelegate::Close() {
313 std::string request = base::StringPrintf(kClosePageRequest, 314 std::string request = base::StringPrintf(kClosePageRequest,
314 remote_id_.c_str()); 315 remote_id_.c_str());
315 device_->SendJsonRequest(browser_id_, request, base::Bind(&NoOp)); 316 device_->SendJsonRequest(browser_id_, request, base::Bind(&NoOp));
316 return true; 317 return true;
317 } 318 }
318 319
320 base::TimeTicks AgentHostDelegate::GetLastActivityTime() {
321 return base::TimeTicks();
322 }
323
319 void AgentHostDelegate::SendMessageToBackend(const std::string& message) { 324 void AgentHostDelegate::SendMessageToBackend(const std::string& message) {
320 // We could have detached due to physical connection being closed. 325 // We could have detached due to physical connection being closed.
321 if (!proxy_) 326 if (!proxy_)
322 return; 327 return;
323 if (socket_opened_) 328 if (socket_opened_)
324 web_socket_->SendFrame(message); 329 web_socket_->SendFrame(message);
325 else 330 else
326 pending_messages_.push_back(message); 331 pending_messages_.push_back(message);
327 } 332 }
328 333
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 } 617 }
613 618
614 void DevToolsDeviceDiscovery::ReceivedDeviceList( 619 void DevToolsDeviceDiscovery::ReceivedDeviceList(
615 const CompleteDevices& complete_devices) { 620 const CompleteDevices& complete_devices) {
616 DCHECK_CURRENTLY_ON(BrowserThread::UI); 621 DCHECK_CURRENTLY_ON(BrowserThread::UI);
617 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList, 622 task_scheduler_.Run(base::Bind(&DevToolsDeviceDiscovery::RequestDeviceList,
618 weak_factory_.GetWeakPtr())); 623 weak_factory_.GetWeakPtr()));
619 // |callback_| should be run last as it may destroy |this|. 624 // |callback_| should be run last as it may destroy |this|.
620 callback_.Run(complete_devices); 625 callback_.Run(complete_devices);
621 } 626 }
OLDNEW
« no previous file with comments | « chrome/browser/android/devtools_manager_delegate_android.cc ('k') | content/browser/devtools/devtools_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698