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

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

Issue 2783113002: nit: Pass ownership of CVDelegate to ContentVerifier using unique_ptr. (Closed)
Patch Set: Created 3 years, 8 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_verifier.h ('k') | no next file » | 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 #include <vector>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 base::JoinString(parts, base::FilePath::StringType(1, '/'))); 53 base::JoinString(parts, base::FilePath::StringType(1, '/')));
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 // static 58 // static
59 void ContentVerifier::SetObserverForTests(TestObserver* observer) { 59 void ContentVerifier::SetObserverForTests(TestObserver* observer) {
60 g_test_observer = observer; 60 g_test_observer = observer;
61 } 61 }
62 62
63 ContentVerifier::ContentVerifier(content::BrowserContext* context, 63 ContentVerifier::ContentVerifier(
64 ContentVerifierDelegate* delegate) 64 content::BrowserContext* context,
65 std::unique_ptr<ContentVerifierDelegate> delegate)
65 : shutdown_(false), 66 : shutdown_(false),
66 context_(context), 67 context_(context),
67 delegate_(delegate), 68 delegate_(std::move(delegate)),
68 fetcher_(new ContentHashFetcher( 69 fetcher_(new ContentHashFetcher(
69 content::BrowserContext::GetDefaultStoragePartition(context) 70 content::BrowserContext::GetDefaultStoragePartition(context)
70 ->GetURLRequestContext(), 71 ->GetURLRequestContext(),
71 delegate, 72 delegate_.get(),
72 base::Bind(&ContentVerifier::OnFetchComplete, this))), 73 base::Bind(&ContentVerifier::OnFetchComplete, this))),
73 observer_(this), 74 observer_(this),
74 io_data_(new ContentVerifierIOData) {} 75 io_data_(new ContentVerifierIOData) {}
75 76
76 ContentVerifier::~ContentVerifier() { 77 ContentVerifier::~ContentVerifier() {
77 } 78 }
78 79
79 void ContentVerifier::Start() { 80 void ContentVerifier::Start() {
80 ExtensionRegistry* registry = ExtensionRegistry::Get(context_); 81 ExtensionRegistry* registry = ExtensionRegistry::Get(context_);
81 observer_.Add(registry); 82 observer_.Add(registry);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 !extension_l10n_util::ShouldSkipValidation( 285 !extension_l10n_util::ShouldSkipValidation(
285 locales_dir, full_path.DirName(), *all_locales)) 286 locales_dir, full_path.DirName(), *all_locales))
286 continue; 287 continue;
287 } 288 }
288 return true; 289 return true;
289 } 290 }
290 return false; 291 return false;
291 } 292 }
292 293
293 } // namespace extensions 294 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/content_verifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698