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

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

Issue 2801583003: developerPrivate.repair: Skip not-corrupted and policy extensions (Closed)
Patch Set: fix WebstoreReinsallerBrowserTest 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') | extensions/browser/mock_external_provider.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 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/storage_partition.h" 16 #include "content/public/browser/storage_partition.h"
17 #include "extensions/browser/content_hash_fetcher.h" 17 #include "extensions/browser/content_hash_fetcher.h"
18 #include "extensions/browser/content_hash_reader.h" 18 #include "extensions/browser/content_hash_reader.h"
19 #include "extensions/browser/content_verifier_delegate.h" 19 #include "extensions/browser/content_verifier_delegate.h"
20 #include "extensions/browser/content_verifier_io_data.h" 20 #include "extensions/browser/content_verifier_io_data.h"
21 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
22 #include "extensions/browser/management_policy.h"
22 #include "extensions/common/constants.h" 23 #include "extensions/common/constants.h"
23 #include "extensions/common/extension_l10n_util.h" 24 #include "extensions/common/extension_l10n_util.h"
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 namespace { 28 namespace {
28 29
29 ContentVerifier::TestObserver* g_test_observer = NULL; 30 ContentVerifier::TestObserver* g_test_observer = NULL;
30 31
31 // This function converts paths like "//foo/bar", "./foo/bar", and 32 // This function converts paths like "//foo/bar", "./foo/bar", and
(...skipping 17 matching lines...) Expand all
49 50
50 // Note that elsewhere we always normalize path separators to '/' so this 51 // Note that elsewhere we always normalize path separators to '/' so this
51 // should work for all platforms. 52 // should work for all platforms.
52 return base::FilePath( 53 return base::FilePath(
53 base::JoinString(parts, base::FilePath::StringType(1, '/'))); 54 base::JoinString(parts, base::FilePath::StringType(1, '/')));
54 } 55 }
55 56
56 } // namespace 57 } // namespace
57 58
58 // static 59 // static
60 bool ContentVerifier::ShouldRepairIfCorrupted(
61 const ManagementPolicy* management_policy,
62 const Extension* extension) {
63 return management_policy->MustRemainEnabled(extension, nullptr) ||
64 management_policy->MustRemainInstalled(extension, nullptr);
65 }
66
67 // static
59 void ContentVerifier::SetObserverForTests(TestObserver* observer) { 68 void ContentVerifier::SetObserverForTests(TestObserver* observer) {
60 g_test_observer = observer; 69 g_test_observer = observer;
61 } 70 }
62 71
63 ContentVerifier::ContentVerifier( 72 ContentVerifier::ContentVerifier(
64 content::BrowserContext* context, 73 content::BrowserContext* context,
65 std::unique_ptr<ContentVerifierDelegate> delegate) 74 std::unique_ptr<ContentVerifierDelegate> delegate)
66 : shutdown_(false), 75 : shutdown_(false),
67 context_(context), 76 context_(context),
68 delegate_(std::move(delegate)), 77 delegate_(std::move(delegate)),
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 !extension_l10n_util::ShouldSkipValidation( 295 !extension_l10n_util::ShouldSkipValidation(
287 locales_dir, full_path.DirName(), *all_locales)) 296 locales_dir, full_path.DirName(), *all_locales))
288 continue; 297 continue;
289 } 298 }
290 return true; 299 return true;
291 } 300 }
292 return false; 301 return false;
293 } 302 }
294 303
295 } // namespace extensions 304 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/content_verifier.h ('k') | extensions/browser/mock_external_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698