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

Side by Side Diff: chrome/browser/signin/easy_unlock_toggle_flow.cc

Issue 685983004: Update EasyUnlockToggleFlow to disable all devices when turning off Smart Lock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | 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 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/signin/easy_unlock_toggle_flow.h" 5 #include "chrome/browser/signin/easy_unlock_toggle_flow.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 EasyUnlockToggleFlow::ToggleApiCall::~ToggleApiCall() { 83 EasyUnlockToggleFlow::ToggleApiCall::~ToggleApiCall() {
84 } 84 }
85 85
86 GURL EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallUrl() { 86 GURL EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallUrl() {
87 return GURL(kEasyUnlockToggleUrl); 87 return GURL(kEasyUnlockToggleUrl);
88 } 88 }
89 89
90 std::string EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallBody() { 90 std::string EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallBody() {
91 const char kBodyFormat[] = "{\"enable\":%s,\"publicKey\":\"%s\"}"; 91 const char kEnableBodyFormat[] = "{\"enable\": true,\"publicKey\":\"%s\"}";
92 return base::StringPrintf( 92 const char kDisableBodyFormat[] =
93 kBodyFormat, 93 "{ \"enable\": false, \"applyToAll\": true }";
94 toggle_enable_ ? "true" : "false", 94
95 phone_public_key_.c_str()); 95 if (toggle_enable_)
96 return base::StringPrintf(kEnableBodyFormat, phone_public_key_.c_str());
97 else
98 return std::string(kDisableBodyFormat);
96 } 99 }
97 100
98 std::string 101 std::string
99 EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallBodyContentType() { 102 EasyUnlockToggleFlow::ToggleApiCall::CreateApiCallBodyContentType() {
100 return "application/json"; 103 return "application/json";
101 } 104 }
102 105
103 void EasyUnlockToggleFlow::ToggleApiCall::ProcessApiCallSuccess( 106 void EasyUnlockToggleFlow::ToggleApiCall::ProcessApiCallSuccess(
104 const net::URLFetcher* source) { 107 const net::URLFetcher* source) {
105 flow_->ReportToggleApiCallResult(true); 108 flow_->ReportToggleApiCallResult(true);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 182 }
180 183
181 void EasyUnlockToggleFlow::OnIssueAdviceSuccess( 184 void EasyUnlockToggleFlow::OnIssueAdviceSuccess(
182 const IssueAdviceInfo& issue_advice) { 185 const IssueAdviceInfo& issue_advice) {
183 NOTREACHED(); 186 NOTREACHED();
184 } 187 }
185 188
186 void EasyUnlockToggleFlow::ReportToggleApiCallResult(bool success) { 189 void EasyUnlockToggleFlow::ReportToggleApiCallResult(bool success) {
187 callback_.Run(success); 190 callback_.Run(success);
188 } 191 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698