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/extension_util.h" | 5 #include "extensions/browser/extension_util.h" |
6 | 6 |
7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
8 #include "content/public/browser/site_instance.h" | 8 #include "content/public/browser/site_instance.h" |
9 #include "extensions/browser/extension_prefs.h" | 9 #include "extensions/browser/extension_prefs.h" |
10 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
| 11 #include "extensions/common/api/declarative_net_request/rules_manifest_info.h" |
11 #include "extensions/common/features/behavior_feature.h" | 12 #include "extensions/common/features/behavior_feature.h" |
12 #include "extensions/common/features/feature.h" | 13 #include "extensions/common/features/feature.h" |
13 #include "extensions/common/features/feature_provider.h" | 14 #include "extensions/common/features/feature_provider.h" |
14 #include "extensions/common/manifest.h" | 15 #include "extensions/common/manifest.h" |
15 #include "extensions/common/manifest_handlers/app_isolation_info.h" | 16 #include "extensions/common/manifest_handlers/app_isolation_info.h" |
16 #include "extensions/common/manifest_handlers/incognito_info.h" | 17 #include "extensions/common/manifest_handlers/incognito_info.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 namespace util { | 20 namespace util { |
20 | 21 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const std::string& extension_id, | 89 const std::string& extension_id, |
89 content::BrowserContext* browser_context) { | 90 content::BrowserContext* browser_context) { |
90 GURL site_url = content::SiteInstance::GetSiteForURL( | 91 GURL site_url = content::SiteInstance::GetSiteForURL( |
91 browser_context, Extension::GetBaseURLFromExtensionId(extension_id)); | 92 browser_context, Extension::GetBaseURLFromExtensionId(extension_id)); |
92 content::StoragePartition* storage_partition = | 93 content::StoragePartition* storage_partition = |
93 content::BrowserContext::GetStoragePartitionForSite(browser_context, | 94 content::BrowserContext::GetStoragePartitionForSite(browser_context, |
94 site_url); | 95 site_url); |
95 return storage_partition; | 96 return storage_partition; |
96 } | 97 } |
97 | 98 |
| 99 bool HasIndexedRuleset(const Extension* extension) { |
| 100 // TODO this needs to change, especially once add/remove rules are supported. |
| 101 // This should probably use ExtensionPrefs. |
| 102 // Also, for e.g. this is not true if the extension is not installed yet. But |
| 103 // that can be added as a check as well. |
| 104 return declarative_net_request::RulesManifestData::GetJSONRulesetPath( |
| 105 extension) != nullptr; |
| 106 } |
| 107 |
98 } // namespace util | 108 } // namespace util |
99 } // namespace extensions | 109 } // namespace extensions |
OLD | NEW |