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

Side by Side Diff: chrome/browser/local_discovery/gcd_base_api_flow.cc

Issue 284223004: List cloud devices in chrome://devices page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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/local_discovery/gcd_base_api_flow.h" 5 #include "chrome/browser/local_discovery/gcd_base_api_flow.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 18 matching lines...) Expand all
29 29
30 void GCDBaseApiFlow::Delegate::GetUploadData(std::string* upload_type, 30 void GCDBaseApiFlow::Delegate::GetUploadData(std::string* upload_type,
31 std::string* upload_data) { 31 std::string* upload_data) {
32 *upload_type = std::string(); 32 *upload_type = std::string();
33 *upload_data = std::string(); 33 *upload_data = std::string();
34 } 34 }
35 35
36 GCDBaseApiFlow::GCDBaseApiFlow(net::URLRequestContextGetter* request_context, 36 GCDBaseApiFlow::GCDBaseApiFlow(net::URLRequestContextGetter* request_context,
37 OAuth2TokenService* token_service, 37 OAuth2TokenService* token_service,
38 const std::string& account_id, 38 const std::string& account_id,
39 const GURL& automated_claim_url, 39 const GURL& url,
40 Delegate* delegate) 40 Delegate* delegate)
41 : OAuth2TokenService::Consumer("cloud_print"), 41 : OAuth2TokenService::Consumer("cloud_print"),
42 request_context_(request_context), 42 request_context_(request_context),
43 token_service_(token_service), 43 token_service_(token_service),
44 account_id_(account_id), 44 account_id_(account_id),
45 url_(automated_claim_url), 45 url_(url),
46 delegate_(delegate) {} 46 delegate_(delegate) {
47 }
47 48
48 GCDBaseApiFlow::~GCDBaseApiFlow() {} 49 GCDBaseApiFlow::~GCDBaseApiFlow() {}
49 50
50 void GCDBaseApiFlow::Start() { 51 void GCDBaseApiFlow::Start() {
51 OAuth2TokenService::ScopeSet oauth_scopes; 52 OAuth2TokenService::ScopeSet oauth_scopes;
52 if (delegate_->GCDIsCloudPrint()) { 53 if (delegate_->GCDIsCloudPrint()) {
53 oauth_scopes.insert(cloud_devices::kCloudPrintAuthScope); 54 oauth_scopes.insert(cloud_devices::kCloudPrintAuthScope);
54 } else { 55 } else {
55 oauth_scopes.insert(cloud_devices::kCloudDevicesAuthScope); 56 oauth_scopes.insert(cloud_devices::kCloudDevicesAuthScope);
56 } 57 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 if (!value || !value->GetAsDictionary(&dictionary_value)) { 125 if (!value || !value->GetAsDictionary(&dictionary_value)) {
125 delegate_->OnGCDAPIFlowError(this, ERROR_MALFORMED_RESPONSE); 126 delegate_->OnGCDAPIFlowError(this, ERROR_MALFORMED_RESPONSE);
126 return; 127 return;
127 } 128 }
128 129
129 delegate_->OnGCDAPIFlowComplete(this, dictionary_value); 130 delegate_->OnGCDAPIFlowComplete(this, dictionary_value);
130 } 131 }
131 132
132 } // namespace local_discovery 133 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/gcd_base_api_flow.h ('k') | chrome/browser/resources/local_discovery/local_discovery.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698