| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/webui/local_discovery/local_discovery_ui_handler.h" | 5 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" | 10 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return; | 174 return; |
| 175 } | 175 } |
| 176 | 176 |
| 177 GURL automated_claim_url(base::StringPrintf( | 177 GURL automated_claim_url(base::StringPrintf( |
| 178 kPrivetAutomatedClaimURLFormat, | 178 kPrivetAutomatedClaimURLFormat, |
| 179 device_descriptions_[current_http_client_->GetName()].url.c_str(), | 179 device_descriptions_[current_http_client_->GetName()].url.c_str(), |
| 180 token.c_str())); | 180 token.c_str())); |
| 181 | 181 |
| 182 Profile* profile = Profile::FromWebUI(web_ui()); | 182 Profile* profile = Profile::FromWebUI(web_ui()); |
| 183 | 183 |
| 184 OAuth2TokenService* token_service = | 184 ProfileOAuth2TokenService* token_service = |
| 185 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 185 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 186 | 186 |
| 187 if (!token_service) { | 187 if (!token_service) { |
| 188 LogRegisterErrorToWeb("Could not get token service"); | 188 LogRegisterErrorToWeb("Could not get token service"); |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 | 191 |
| 192 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( | 192 confirm_api_call_flow_.reset(new PrivetConfirmApiCallFlow( |
| 193 profile->GetRequestContext(), | 193 profile->GetRequestContext(), |
| 194 token_service, | 194 token_service, |
| 195 token_service->GetPrimaryAccountId(), |
| 195 automated_claim_url, | 196 automated_claim_url, |
| 196 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, | 197 base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone, |
| 197 base::Unretained(this)))); | 198 base::Unretained(this)))); |
| 198 | 199 |
| 199 confirm_api_call_flow_->Start(); | 200 confirm_api_call_flow_->Start(); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void LocalDiscoveryUIHandler::OnPrivetRegisterError( | 203 void LocalDiscoveryUIHandler::OnPrivetRegisterError( |
| 203 PrivetRegisterOperation* operation, | 204 PrivetRegisterOperation* operation, |
| 204 const std::string& action, | 205 const std::string& action, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 295 } |
| 295 | 296 |
| 296 void LocalDiscoveryUIHandler::SetIsVisible(bool visible) { | 297 void LocalDiscoveryUIHandler::SetIsVisible(bool visible) { |
| 297 if (visible != is_visible_) { | 298 if (visible != is_visible_) { |
| 298 g_num_visible += visible ? 1 : -1; | 299 g_num_visible += visible ? 1 : -1; |
| 299 is_visible_ = visible; | 300 is_visible_ = visible; |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace local_discovery | 304 } // namespace local_discovery |
| OLD | NEW |