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

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

Issue 912863002: [DevTools] Remote JSON requests from javascript (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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_android_bridge.h" 5 #include "chrome/browser/devtools/device/devtools_android_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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 DevToolsAndroidBridge::GetBrowserAgentHost( 671 DevToolsAndroidBridge::GetBrowserAgentHost(
672 scoped_refptr<RemoteBrowser> browser) { 672 scoped_refptr<RemoteBrowser> browser) {
673 return AgentHostDelegate::GetOrCreateAgentHost( 673 return AgentHostDelegate::GetOrCreateAgentHost(
674 this, 674 this,
675 "adb:" + browser->serial() + ":" + browser->socket(), 675 "adb:" + browser->serial() + ":" + browser->socket(),
676 browser->browser_id_, 676 browser->browser_id_,
677 kBrowserTargetSocket, 677 kBrowserTargetSocket,
678 browser->IsWebView()); 678 browser->IsWebView());
679 } 679 }
680 680
681 void DevToolsAndroidBridge::SendJsonRequest(
682 const std::string& browser_id_str,
683 const std::string& url,
684 const JsonRequestCallback& callback) {
685 size_t colon_pos = browser_id_str.find(':');
dgozman 2015/03/12 12:45:27 Please extract this into separate BrowserIdFromStr
vkuzkokov 2015/03/12 14:20:11 Done.
686 if (colon_pos == std::string::npos) {
687 callback.Run(net::ERR_FAILED, std::string());
688 return;
689 }
690 SendJsonRequest(BrowserId(browser_id_str.substr(0, colon_pos),
691 browser_id_str.substr(colon_pos + 1)),
692 url,
693 callback);
694 }
695
681 scoped_refptr<AndroidDeviceManager::Device> DevToolsAndroidBridge::FindDevice( 696 scoped_refptr<AndroidDeviceManager::Device> DevToolsAndroidBridge::FindDevice(
682 const std::string& serial) { 697 const std::string& serial) {
683 DeviceMap::iterator it = device_map_.find(serial); 698 DeviceMap::iterator it = device_map_.find(serial);
684 return it == device_map_.end() ? nullptr : it->second; 699 return it == device_map_.end() ? nullptr : it->second;
685 } 700 }
686 701
687 void DevToolsAndroidBridge::RespondToOpenOnUIThread( 702 void DevToolsAndroidBridge::RespondToOpenOnUIThread(
688 scoped_refptr<RemoteBrowser> browser, 703 scoped_refptr<RemoteBrowser> browser,
689 const RemotePageCallback& callback, 704 const RemotePageCallback& callback,
690 int result, 705 int result,
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 device_providers.push_back( 1027 device_providers.push_back(
1013 new WebRTCDeviceProvider(profile_, signin_manager_, token_service_)); 1028 new WebRTCDeviceProvider(profile_, signin_manager_, token_service_));
1014 } 1029 }
1015 1030
1016 device_manager_->SetDeviceProviders(device_providers); 1031 device_manager_->SetDeviceProviders(device_providers);
1017 if (NeedsDeviceListPolling()) { 1032 if (NeedsDeviceListPolling()) {
1018 StopDeviceListPolling(); 1033 StopDeviceListPolling();
1019 StartDeviceListPolling(); 1034 StartDeviceListPolling();
1020 } 1035 }
1021 } 1036 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698