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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "base/values.h" | 26 #include "base/values.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "crypto/random.h" | 29 #include "crypto/random.h" |
30 #include "crypto/secure_hash.h" | 30 #include "crypto/secure_hash.h" |
31 #include "crypto/sha2.h" | 31 #include "crypto/sha2.h" |
32 #include "crypto/signature_verifier.h" | 32 #include "crypto/signature_verifier.h" |
33 #include "net/traffic_annotation/network_traffic_annotation.h" | |
33 #include "net/url_request/url_fetcher.h" | 34 #include "net/url_request/url_fetcher.h" |
34 #include "net/url_request/url_fetcher_delegate.h" | 35 #include "net/url_request/url_fetcher_delegate.h" |
35 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
36 #include "net/url_request/url_request_status.h" | 37 #include "net/url_request/url_request_status.h" |
37 #include "rlz/features/features.h" | 38 #include "rlz/features/features.h" |
38 #include "url/gurl.h" | 39 #include "url/gurl.h" |
39 | 40 |
40 #if BUILDFLAG(ENABLE_RLZ) | 41 #if BUILDFLAG(ENABLE_RLZ) |
41 #include "rlz/lib/machine_id.h" | 42 #include "rlz/lib/machine_id.h" |
42 #endif | 43 #endif |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 | 367 |
367 if (!context_getter_) { | 368 if (!context_getter_) { |
368 ReportErrorViaCallback(); | 369 ReportErrorViaCallback(); |
369 return; | 370 return; |
370 } | 371 } |
371 | 372 |
372 base::Closure closure = base::Bind(&InstallSigner::ParseFetchResponse, | 373 base::Closure closure = base::Bind(&InstallSigner::ParseFetchResponse, |
373 base::Unretained(this)); | 374 base::Unretained(this)); |
374 | 375 |
375 delegate_.reset(new FetcherDelegate(closure)); | 376 delegate_.reset(new FetcherDelegate(closure)); |
377 net::NetworkTrafficAnnotationTag traffic_annotation = | |
378 net::DefineNetworkTrafficAnnotation("...", R"( | |
379 semantics { | |
380 sender: "..." | |
Devlin
2017/04/19 20:27:07
extension install signer
Ramin Halavati
2017/04/21 05:50:40
Done.
| |
381 description: "..." | |
Devlin
2017/04/19 20:27:07
Fetches the signatures for installed extensions
Ramin Halavati
2017/04/21 05:50:41
Done.
| |
382 trigger: "..." | |
Devlin
2017/04/19 20:27:07
Chrome detects an extension that requires installa
Ramin Halavati
2017/04/21 05:50:41
Done.
| |
383 data: "..." | |
Devlin
2017/04/19 20:27:07
The ids of the extensions that need to be verified
Ramin Halavati
2017/04/21 05:50:41
Done.
| |
384 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER | |
Devlin
2017/04/19 20:27:07
GOOGLE_OWNED_SERVICE
Ramin Halavati
2017/04/21 05:50:40
Done.
| |
385 } | |
386 policy { | |
387 cookies_allowed: false/true | |
388 cookies_store: "..." | |
389 setting: "..." | |
390 chrome_policy { | |
Devlin
2017/04/19 20:27:07
This setting can be disabled by not installing any
Ramin Halavati
2017/04/21 05:50:41
Done.
| |
391 [POLICY_NAME] { | |
392 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
393 [POLICY_NAME]: ... //(value to disable it) | |
394 } | |
395 } | |
396 policy_exception_justification: "..." | |
397 })"); | |
376 url_fetcher_ = net::URLFetcher::Create(GetBackendUrl(), net::URLFetcher::POST, | 398 url_fetcher_ = net::URLFetcher::Create(GetBackendUrl(), net::URLFetcher::POST, |
377 delegate_.get()); | 399 delegate_.get(), traffic_annotation); |
378 url_fetcher_->SetRequestContext(context_getter_); | 400 url_fetcher_->SetRequestContext(context_getter_); |
379 | 401 |
380 // The request protocol is JSON of the form: | 402 // The request protocol is JSON of the form: |
381 // { | 403 // { |
382 // "protocol_version": "1", | 404 // "protocol_version": "1", |
383 // "hash": "<base64-encoded hash value here>", | 405 // "hash": "<base64-encoded hash value here>", |
384 // "ids": [ "<id1>", "id2" ] | 406 // "ids": [ "<id1>", "id2" ] |
385 // } | 407 // } |
386 base::DictionaryValue dictionary; | 408 base::DictionaryValue dictionary; |
387 dictionary.SetInteger(kProtocolVersionKey, 1); | 409 dictionary.SetInteger(kProtocolVersionKey, 1); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 if (!verified) | 527 if (!verified) |
506 result.reset(); | 528 result.reset(); |
507 } | 529 } |
508 | 530 |
509 if (!callback_.is_null()) | 531 if (!callback_.is_null()) |
510 callback_.Run(std::move(result)); | 532 callback_.Run(std::move(result)); |
511 } | 533 } |
512 | 534 |
513 | 535 |
514 } // namespace extensions | 536 } // namespace extensions |
OLD | NEW |