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

Side by Side Diff: extensions/browser/content_verifier.cc

Issue 2336403002: Fix extension content verification out-of-band hash fetching (Closed)
Patch Set: review feedback Created 4 years, 3 months 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 | « extensions/browser/content_hash_fetcher_unittest.cc ('k') | extensions/common/constants.h » ('j') | 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 "extensions/browser/content_verifier.h" 5 #include "extensions/browser/content_verifier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector>
9 10
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/storage_partition.h"
14 #include "extensions/browser/content_hash_fetcher.h" 17 #include "extensions/browser/content_hash_fetcher.h"
15 #include "extensions/browser/content_hash_reader.h" 18 #include "extensions/browser/content_hash_reader.h"
16 #include "extensions/browser/content_verifier_delegate.h" 19 #include "extensions/browser/content_verifier_delegate.h"
17 #include "extensions/browser/content_verifier_io_data.h" 20 #include "extensions/browser/content_verifier_io_data.h"
18 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
19 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
20 #include "extensions/common/extension_l10n_util.h" 23 #include "extensions/common/extension_l10n_util.h"
21 24
22 namespace extensions { 25 namespace extensions {
23 26
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void ContentVerifier::SetObserverForTests(TestObserver* observer) { 59 void ContentVerifier::SetObserverForTests(TestObserver* observer) {
57 g_test_observer = observer; 60 g_test_observer = observer;
58 } 61 }
59 62
60 ContentVerifier::ContentVerifier(content::BrowserContext* context, 63 ContentVerifier::ContentVerifier(content::BrowserContext* context,
61 ContentVerifierDelegate* delegate) 64 ContentVerifierDelegate* delegate)
62 : shutdown_(false), 65 : shutdown_(false),
63 context_(context), 66 context_(context),
64 delegate_(delegate), 67 delegate_(delegate),
65 fetcher_(new ContentHashFetcher( 68 fetcher_(new ContentHashFetcher(
66 context, 69 content::BrowserContext::GetDefaultStoragePartition(context)
70 ->GetURLRequestContext(),
67 delegate, 71 delegate,
68 base::Bind(&ContentVerifier::OnFetchComplete, this))), 72 base::Bind(&ContentVerifier::OnFetchComplete, this))),
69 observer_(this), 73 observer_(this),
70 io_data_(new ContentVerifierIOData) { 74 io_data_(new ContentVerifierIOData) {}
71 }
72 75
73 ContentVerifier::~ContentVerifier() { 76 ContentVerifier::~ContentVerifier() {
74 } 77 }
75 78
76 void ContentVerifier::Start() { 79 void ContentVerifier::Start() {
77 ExtensionRegistry* registry = ExtensionRegistry::Get(context_); 80 ExtensionRegistry* registry = ExtensionRegistry::Get(context_);
78 observer_.Add(registry); 81 observer_.Add(registry);
79 } 82 }
80 83
81 void ContentVerifier::Shutdown() { 84 void ContentVerifier::Shutdown() {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 !extension_l10n_util::ShouldSkipValidation( 284 !extension_l10n_util::ShouldSkipValidation(
282 locales_dir, full_path.DirName(), *all_locales)) 285 locales_dir, full_path.DirName(), *all_locales))
283 continue; 286 continue;
284 } 287 }
285 return true; 288 return true;
286 } 289 }
287 return false; 290 return false;
288 } 291 }
289 292
290 } // namespace extensions 293 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/content_hash_fetcher_unittest.cc ('k') | extensions/common/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698