Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "extensions/browser/content_hash_fetcher.h" | 5 #include "extensions/browser/content_hash_fetcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "crypto/sha2.h" | 25 #include "crypto/sha2.h" |
| 26 #include "extensions/browser/computed_hashes.h" | 26 #include "extensions/browser/computed_hashes.h" |
| 27 #include "extensions/browser/content_hash_tree.h" | 27 #include "extensions/browser/content_hash_tree.h" |
| 28 #include "extensions/browser/content_verifier_delegate.h" | 28 #include "extensions/browser/content_verifier_delegate.h" |
| 29 #include "extensions/browser/verified_contents.h" | 29 #include "extensions/browser/verified_contents.h" |
| 30 #include "extensions/common/constants.h" | 30 #include "extensions/common/constants.h" |
| 31 #include "extensions/common/extension.h" | 31 #include "extensions/common/extension.h" |
| 32 #include "extensions/common/file_util.h" | 32 #include "extensions/common/file_util.h" |
| 33 #include "net/base/load_flags.h" | 33 #include "net/base/load_flags.h" |
| 34 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 34 #include "net/url_request/url_fetcher.h" | 35 #include "net/url_request/url_fetcher.h" |
| 35 #include "net/url_request/url_fetcher_delegate.h" | 36 #include "net/url_request/url_fetcher_delegate.h" |
| 36 #include "net/url_request/url_request_status.h" | 37 #include "net/url_request/url_request_status.h" |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 typedef std::set<base::FilePath> SortedFilePathSet; | 41 typedef std::set<base::FilePath> SortedFilePathSet; |
| 41 | 42 |
| 42 } // namespace | 43 } // namespace |
| 43 | 44 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 234 |
| 234 void ContentHashFetcherJob::DoneCheckingForVerifiedContents(bool found) { | 235 void ContentHashFetcherJob::DoneCheckingForVerifiedContents(bool found) { |
| 235 if (IsCancelled()) | 236 if (IsCancelled()) |
| 236 return; | 237 return; |
| 237 if (found) { | 238 if (found) { |
| 238 VLOG(1) << "Found verified contents for " << extension_id_; | 239 VLOG(1) << "Found verified contents for " << extension_id_; |
| 239 DoneFetchingVerifiedContents(true); | 240 DoneFetchingVerifiedContents(true); |
| 240 } else { | 241 } else { |
| 241 VLOG(1) << "Missing verified contents for " << extension_id_ | 242 VLOG(1) << "Missing verified contents for " << extension_id_ |
| 242 << ", fetching..."; | 243 << ", fetching..."; |
| 243 url_fetcher_ = | 244 net::NetworkTrafficAnnotationTag traffic_annotation = |
| 244 net::URLFetcher::Create(fetch_url_, net::URLFetcher::GET, this); | 245 net::DefineNetworkTrafficAnnotation("...", R"( |
|
Devlin
2017/03/11 03:17:13
ContentHashVerificationJob
Ramin Halavati
2017/03/11 16:04:59
Done.
| |
| 246 semantics { | |
| 247 sender: "..." | |
|
Devlin
2017/03/11 03:17:13
ContentHashFetcherJob
Ramin Halavati
2017/03/11 16:05:00
Done.
| |
| 248 description: "..." | |
|
Devlin
2017/03/11 03:17:13
The request sent to retrieve the verified_contents
Ramin Halavati
2017/03/11 16:05:00
Done.
| |
| 249 trigger: "..." | |
|
Devlin
2017/03/11 03:17:13
An extension from the webstore is missing the veri
Ramin Halavati
2017/03/11 16:05:00
Done.
| |
| 250 data: "..." | |
|
Devlin
2017/03/11 03:17:13
The extension id and extension version.
Ramin Halavati
2017/03/11 16:04:59
Done.
| |
| 251 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER | |
| 252 } | |
| 253 policy { | |
| 254 cookies_allowed: false | |
| 255 setting: "..." | |
|
Devlin
2017/03/11 03:17:13
This feature cannot be directly disabled; it is en
Ramin Halavati
2017/03/11 16:05:00
Done.
| |
| 256 policy { | |
| 257 [POLICY_NAME] { | |
| 258 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
| 259 [POLICY_NAME]: ... //(value to disable it) | |
| 260 } | |
| 261 } | |
| 262 policy_exception_justification: "..." | |
|
Devlin
2017/03/11 03:17:13
This policy only takes effect if the user has exte
Ramin Halavati
2017/03/11 16:04:59
Done.
| |
| 263 })"); | |
| 264 url_fetcher_ = net::URLFetcher::Create(fetch_url_, net::URLFetcher::GET, | |
| 265 this, traffic_annotation); | |
| 245 url_fetcher_->SetRequestContext(request_context_); | 266 url_fetcher_->SetRequestContext(request_context_); |
| 246 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 267 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 247 net::LOAD_DO_NOT_SAVE_COOKIES | | 268 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 248 net::LOAD_DISABLE_CACHE); | 269 net::LOAD_DISABLE_CACHE); |
| 249 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 270 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
| 250 url_fetcher_->Start(); | 271 url_fetcher_->Start(); |
| 251 } | 272 } |
| 252 } | 273 } |
| 253 | 274 |
| 254 // Helper function to let us pass ownership of a string via base::Bind with the | 275 // Helper function to let us pass ownership of a string via base::Bind with the |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 | 518 |
| 498 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { | 519 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { |
| 499 if (i->second.get() == job) { | 520 if (i->second.get() == job) { |
| 500 jobs_.erase(i); | 521 jobs_.erase(i); |
| 501 break; | 522 break; |
| 502 } | 523 } |
| 503 } | 524 } |
| 504 } | 525 } |
| 505 | 526 |
| 506 } // namespace extensions | 527 } // namespace extensions |
| OLD | NEW |