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/extensions/install_signer.h" | 5 #include "chrome/browser/extensions/install_signer.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 if (!context_getter_) { | 363 if (!context_getter_) { |
364 ReportErrorViaCallback(); | 364 ReportErrorViaCallback(); |
365 return; | 365 return; |
366 } | 366 } |
367 | 367 |
368 base::Closure closure = base::Bind(&InstallSigner::ParseFetchResponse, | 368 base::Closure closure = base::Bind(&InstallSigner::ParseFetchResponse, |
369 base::Unretained(this)); | 369 base::Unretained(this)); |
370 | 370 |
371 delegate_.reset(new FetcherDelegate(closure)); | 371 delegate_.reset(new FetcherDelegate(closure)); |
372 url_fetcher_.reset(net::URLFetcher::Create( | 372 url_fetcher_ = net::URLFetcher::Create(GetBackendUrl(), net::URLFetcher::POST, |
373 GetBackendUrl(), net::URLFetcher::POST, delegate_.get())); | 373 delegate_.get()); |
374 url_fetcher_->SetRequestContext(context_getter_); | 374 url_fetcher_->SetRequestContext(context_getter_); |
375 | 375 |
376 // The request protocol is JSON of the form: | 376 // The request protocol is JSON of the form: |
377 // { | 377 // { |
378 // "protocol_version": "1", | 378 // "protocol_version": "1", |
379 // "hash": "<base64-encoded hash value here>", | 379 // "hash": "<base64-encoded hash value here>", |
380 // "ids": [ "<id1>", "id2" ] | 380 // "ids": [ "<id1>", "id2" ] |
381 // } | 381 // } |
382 base::DictionaryValue dictionary; | 382 base::DictionaryValue dictionary; |
383 dictionary.SetInteger(kProtocolVersionKey, 1); | 383 dictionary.SetInteger(kProtocolVersionKey, 1); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (!verified) | 501 if (!verified) |
502 result.reset(); | 502 result.reset(); |
503 } | 503 } |
504 | 504 |
505 if (!callback_.is_null()) | 505 if (!callback_.is_null()) |
506 callback_.Run(result.Pass()); | 506 callback_.Run(result.Pass()); |
507 } | 507 } |
508 | 508 |
509 | 509 |
510 } // namespace extensions | 510 } // namespace extensions |
OLD | NEW |