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

Side by Side Diff: chrome/browser/devtools/devtools_adb_bridge.cc

Issue 136113019: Cleanup: Remove some unused code, or make them platform specific. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix build Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_net_benchmarking_message_filter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/devtools_adb_bridge.h" 5 #include "chrome/browser/devtools/devtools_adb_bridge.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 scoped_ptr<DevToolsAdbBridge::RemoteDevices> remote_devices_; 291 scoped_ptr<DevToolsAdbBridge::RemoteDevices> remote_devices_;
292 DevToolsAdbBridge::DeviceProviders device_providers_; 292 DevToolsAdbBridge::DeviceProviders device_providers_;
293 }; 293 };
294 294
295 AdbPagesCommand::AdbPagesCommand( 295 AdbPagesCommand::AdbPagesCommand(
296 scoped_refptr<RefCountedAdbThread> adb_thread, 296 scoped_refptr<RefCountedAdbThread> adb_thread,
297 const DevToolsAdbBridge::DeviceProviders& device_providers, 297 const DevToolsAdbBridge::DeviceProviders& device_providers,
298 const Callback& callback) 298 const Callback& callback)
299 : adb_thread_(adb_thread), 299 : adb_thread_(adb_thread),
300 callback_(callback), 300 callback_(callback),
301 device_providers_(device_providers){ 301 device_providers_(device_providers) {
302 remote_devices_.reset(new DevToolsAdbBridge::RemoteDevices()); 302 remote_devices_.reset(new DevToolsAdbBridge::RemoteDevices());
303 303
304 ProcessDeviceProviders(); 304 ProcessDeviceProviders();
305 } 305 }
306 306
307 AdbPagesCommand::~AdbPagesCommand() { 307 AdbPagesCommand::~AdbPagesCommand() {
308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
309 } 309 }
310 310
311 void AdbPagesCommand::ProcessDeviceProviders() { 311 void AdbPagesCommand::ProcessDeviceProviders() {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 content::BrowserContext* context) const { 723 content::BrowserContext* context) const {
724 return new DevToolsAdbBridge::Wrapper(); 724 return new DevToolsAdbBridge::Wrapper();
725 } 725 }
726 726
727 727
728 // AgentHostDelegate ---------------------------------------------------------- 728 // AgentHostDelegate ----------------------------------------------------------
729 729
730 class AgentHostDelegate : public content::DevToolsExternalAgentProxyDelegate, 730 class AgentHostDelegate : public content::DevToolsExternalAgentProxyDelegate,
731 public AdbWebSocket::Delegate { 731 public AdbWebSocket::Delegate {
732 public: 732 public:
733 static void Create(const std::string& id, 733 static void Create(const std::string& id,
734 scoped_refptr<DevToolsAdbBridge::RemoteBrowser> browser, 734 scoped_refptr<DevToolsAdbBridge::RemoteBrowser> browser,
735 const std::string& debug_url, 735 const std::string& debug_url,
736 const std::string& frontend_url, 736 const std::string& frontend_url,
737 Profile* profile) { 737 Profile* profile) {
738 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 738 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
739 AgentHostDelegates::iterator it = 739 AgentHostDelegates::iterator it =
740 g_host_delegates.Get().find(id); 740 g_host_delegates.Get().find(id);
741 if (it != g_host_delegates.Get().end()) { 741 if (it != g_host_delegates.Get().end()) {
742 it->second->OpenFrontend(); 742 it->second->OpenFrontend();
743 } else if (!frontend_url.empty()) { 743 } else if (!frontend_url.empty()) {
744 new AgentHostDelegate( 744 new AgentHostDelegate(
745 id, browser->device(), browser->socket(), debug_url, 745 id, browser->device(), browser->socket(), debug_url,
746 frontend_url, browser->adb_thread()->message_loop(), profile); 746 frontend_url, browser->adb_thread()->message_loop(), profile);
747 } 747 }
748 } 748 }
749 749
750 private: 750 private:
751 AgentHostDelegate( 751 AgentHostDelegate(
752 const std::string& id, 752 const std::string& id,
753 scoped_refptr<AndroidDevice> device, 753 scoped_refptr<AndroidDevice> device,
754 const std::string& socket_name, 754 const std::string& socket_name,
755 const std::string& debug_url, 755 const std::string& debug_url,
756 const std::string& frontend_url, 756 const std::string& frontend_url,
757 base::MessageLoop* adb_message_loop, 757 base::MessageLoop* adb_message_loop,
758 Profile* profile) 758 Profile* profile)
759 : id_(id), 759 : id_(id),
760 frontend_url_(frontend_url), 760 frontend_url_(frontend_url),
761 adb_message_loop_(adb_message_loop),
762 profile_(profile) { 761 profile_(profile) {
763 web_socket_ = new AdbWebSocket( 762 web_socket_ = new AdbWebSocket(
764 device, socket_name, debug_url, adb_message_loop, this); 763 device, socket_name, debug_url, adb_message_loop, this);
765 g_host_delegates.Get()[id] = this; 764 g_host_delegates.Get()[id] = this;
766 765
767 if (socket_name.find(kWebViewSocketPrefix) == 0) { 766 if (socket_name.find(kWebViewSocketPrefix) == 0) {
768 content::RecordAction( 767 content::RecordAction(
769 base::UserMetricsAction("DevTools_InspectAndroidWebView")); 768 base::UserMetricsAction("DevTools_InspectAndroidWebView"));
770 } else { 769 } else {
771 content::RecordAction( 770 content::RecordAction(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 proxy_->ConnectionClosed(); 807 proxy_->ConnectionClosed();
809 delete this; 808 delete this;
810 } 809 }
811 810
812 virtual bool ProcessIncomingMessage(const std::string& message) OVERRIDE { 811 virtual bool ProcessIncomingMessage(const std::string& message) OVERRIDE {
813 return false; 812 return false;
814 } 813 }
815 814
816 const std::string id_; 815 const std::string id_;
817 const std::string frontend_url_; 816 const std::string frontend_url_;
818 base::MessageLoop* adb_message_loop_;
819 Profile* profile_; 817 Profile* profile_;
820 818
821 scoped_ptr<content::DevToolsExternalAgentProxy> proxy_; 819 scoped_ptr<content::DevToolsExternalAgentProxy> proxy_;
822 scoped_refptr<AdbWebSocket> web_socket_; 820 scoped_refptr<AdbWebSocket> web_socket_;
823 DISALLOW_COPY_AND_ASSIGN(AgentHostDelegate); 821 DISALLOW_COPY_AND_ASSIGN(AgentHostDelegate);
824 }; 822 };
825 823
826 //// RemotePageTarget ---------------------------------------------- 824 //// RemotePageTarget ----------------------------------------------
827 825
828 class RemotePageTarget : public DevToolsTargetImpl { 826 class RemotePageTarget : public DevToolsTargetImpl {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1140
1143 if (listeners_.empty()) 1141 if (listeners_.empty())
1144 return; 1142 return;
1145 1143
1146 BrowserThread::PostDelayedTask( 1144 BrowserThread::PostDelayedTask(
1147 BrowserThread::UI, 1145 BrowserThread::UI,
1148 FROM_HERE, 1146 FROM_HERE,
1149 base::Bind(&DevToolsAdbBridge::RequestRemoteDevices, this), 1147 base::Bind(&DevToolsAdbBridge::RequestRemoteDevices, this),
1150 base::TimeDelta::FromMilliseconds(kAdbPollingIntervalMs)); 1148 base::TimeDelta::FromMilliseconds(kAdbPollingIntervalMs));
1151 } 1149 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_net_benchmarking_message_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698