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 "chrome/browser/extensions/extension_management.h" | 5 #include "chrome/browser/extensions/extension_management.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 if (managed) | 118 if (managed) |
| 119 pref_service_->RemoveManagedPref(path); | 119 pref_service_->RemoveManagedPref(path); |
| 120 else | 120 else |
| 121 pref_service_->RemoveUserPref(path); | 121 pref_service_->RemoveUserPref(path); |
| 122 } | 122 } |
| 123 | 123 |
| 124 const internal::GlobalSettings* ReadGlobalSettings() { | 124 const internal::GlobalSettings* ReadGlobalSettings() { |
| 125 return extension_management_->global_settings_.get(); | 125 return extension_management_->global_settings_.get(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 const URLPatternSet& GetRuntimeBlockedHostsById(const std::string& id) { | 128 URLPatternSet GetRuntimeBlockedHostsById(const std::string& id) { |
|
Devlin
2017/01/26 22:47:39
Why this change?
nrpeter
2017/02/03 19:32:24
It was a syntax issue I didn't detect earlier by c
| |
| 129 return GetRuntimeBlockedHosts(id, kNonExistingUpdateUrl); | 129 return GetRuntimeBlockedHosts(id, kNonExistingUpdateUrl); |
| 130 } | 130 } |
| 131 | 131 |
| 132 ExtensionManagement::InstallationMode GetInstallationModeById( | 132 ExtensionManagement::InstallationMode GetInstallationModeById( |
| 133 const std::string& id) { | 133 const std::string& id) { |
| 134 return GetInstallationMode(id, kNonExistingUpdateUrl); | 134 return GetInstallationMode(id, kNonExistingUpdateUrl); |
| 135 } | 135 } |
| 136 | 136 |
| 137 ExtensionManagement::InstallationMode GetInstallationModeByUpdateUrl( | 137 ExtensionManagement::InstallationMode GetInstallationModeByUpdateUrl( |
| 138 const std::string& update_url) { | 138 const std::string& update_url) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 EXPECT_EQ(GetInstallationModeById(kTargetExtension2), | 434 EXPECT_EQ(GetInstallationModeById(kTargetExtension2), |
| 435 ExtensionManagement::INSTALLATION_FORCED); | 435 ExtensionManagement::INSTALLATION_FORCED); |
| 436 CheckAutomaticallyInstalledUpdateUrl(kTargetExtension2, kExampleUpdateUrl); | 436 CheckAutomaticallyInstalledUpdateUrl(kTargetExtension2, kExampleUpdateUrl); |
| 437 EXPECT_EQ(GetInstallationModeById(kTargetExtension3), | 437 EXPECT_EQ(GetInstallationModeById(kTargetExtension3), |
| 438 ExtensionManagement::INSTALLATION_RECOMMENDED); | 438 ExtensionManagement::INSTALLATION_RECOMMENDED); |
| 439 CheckAutomaticallyInstalledUpdateUrl(kTargetExtension3, kExampleUpdateUrl); | 439 CheckAutomaticallyInstalledUpdateUrl(kTargetExtension3, kExampleUpdateUrl); |
| 440 EXPECT_EQ(GetInstallationModeById(kNonExistingExtension), | 440 EXPECT_EQ(GetInstallationModeById(kNonExistingExtension), |
| 441 ExtensionManagement::INSTALLATION_BLOCKED); | 441 ExtensionManagement::INSTALLATION_BLOCKED); |
| 442 EXPECT_EQ(GetInstallationModeByUpdateUrl(kExampleUpdateUrl), | 442 EXPECT_EQ(GetInstallationModeByUpdateUrl(kExampleUpdateUrl), |
| 443 ExtensionManagement::INSTALLATION_ALLOWED); | 443 ExtensionManagement::INSTALLATION_ALLOWED); |
| 444 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension).empty()); | 444 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension).is_empty()); |
| 445 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension4) | 445 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension4) |
| 446 .MatchesURL(GURL("http://test.foo.com/test"))); | 446 .MatchesURL(GURL("http://test.foo.com/test"))); |
| 447 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension4) | 447 EXPECT_TRUE(GetRuntimeBlockedHostsById(kTargetExtension4) |
| 448 .MatchesURL(GURL("https://bar.org/test"))); | 448 .MatchesURL(GURL("https://bar.org/test"))); |
| 449 | 449 |
| 450 // Verifies global settings. | 450 // Verifies global settings. |
| 451 EXPECT_TRUE(ReadGlobalSettings()->has_restricted_install_sources); | 451 EXPECT_TRUE(ReadGlobalSettings()->has_restricted_install_sources); |
| 452 const URLPatternSet& allowed_sites = ReadGlobalSettings()->install_sources; | 452 const URLPatternSet& allowed_sites = ReadGlobalSettings()->install_sources; |
| 453 EXPECT_EQ(allowed_sites.size(), 1u); | 453 EXPECT_EQ(allowed_sites.size(), 1u); |
| 454 EXPECT_TRUE(allowed_sites.MatchesURL(GURL("http://foo.com/entry"))); | 454 EXPECT_TRUE(allowed_sites.MatchesURL(GURL("http://foo.com/entry"))); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 EXPECT_FALSE(error.empty()); | 902 EXPECT_FALSE(error.empty()); |
| 903 | 903 |
| 904 CreateExtension(Manifest::INTERNAL); | 904 CreateExtension(Manifest::INTERNAL); |
| 905 error.clear(); | 905 error.clear(); |
| 906 EXPECT_FALSE(MustRemainEnabled(extension_.get(), NULL)); | 906 EXPECT_FALSE(MustRemainEnabled(extension_.get(), NULL)); |
| 907 EXPECT_FALSE(MustRemainEnabled(extension_.get(), &error)); | 907 EXPECT_FALSE(MustRemainEnabled(extension_.get(), &error)); |
| 908 EXPECT_TRUE(error.empty()); | 908 EXPECT_TRUE(error.empty()); |
| 909 } | 909 } |
| 910 | 910 |
| 911 } // namespace extensions | 911 } // namespace extensions |
| OLD | NEW |