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

Side by Side Diff: chrome/browser/devtools/device/webrtc/send_command_request.cc

Issue 1560583002: DevTools: remove experimental webrtc-based remote debugging device provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests/gyp removals Created 4 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/devtools/device/webrtc/send_command_request.h"
6
7 #include "base/json/json_writer.h"
8 #include "base/values.h"
9 #include "components/cloud_devices/common/cloud_devices_urls.h"
10 #include "net/base/url_util.h"
11
12 using local_discovery::GCDApiFlow;
13 using local_discovery::GCDApiFlowRequest;
14
15 namespace {
16
17 const char kContentTypeJSON[] = "application/json";
18 const char kCommandTimeoutMs[] = "20000";
19
20 } // namespace
21
22 SendCommandRequest::SendCommandRequest(const base::DictionaryValue* request,
23 Delegate* delegate)
24 : delegate_(delegate) {
25 base::JSONWriter::Write(*request, &upload_data_);
26 DCHECK(delegate_);
27 }
28
29 net::URLFetcher::RequestType SendCommandRequest::GetRequestType() {
30 return net::URLFetcher::POST;
31 }
32
33 void SendCommandRequest::GetUploadData(std::string* upload_type,
34 std::string* upload_data) {
35 *upload_type = kContentTypeJSON;
36 *upload_data = upload_data_;
37 }
38
39 void SendCommandRequest::OnGCDAPIFlowError(GCDApiFlow::Status status) {
40 delegate_->OnCommandFailed();
41 }
42
43 void SendCommandRequest::OnGCDAPIFlowComplete(
44 const base::DictionaryValue& value) {
45 delegate_->OnCommandSucceeded(value);
46 }
47
48 GURL SendCommandRequest::GetURL() {
49 GURL url = cloud_devices::GetCloudDevicesRelativeURL("commands");
50 url = net::AppendQueryParameter(url, "expireInMs", kCommandTimeoutMs);
51 url = net::AppendQueryParameter(url, "responseAwaitMs", kCommandTimeoutMs);
52 return url;
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698