OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 740 |
741 void SetPrefStringSet(const std::string& extension_id, | 741 void SetPrefStringSet(const std::string& extension_id, |
742 const std::string& pref_path, | 742 const std::string& pref_path, |
743 const std::set<std::string>& value) { | 743 const std::set<std::string>& value) { |
744 std::string msg = " while setting: "; | 744 std::string msg = " while setting: "; |
745 msg += extension_id + " " + pref_path; | 745 msg += extension_id + " " + pref_path; |
746 | 746 |
747 base::ListValue* list_value = new base::ListValue(); | 747 base::ListValue* list_value = new base::ListValue(); |
748 for (std::set<std::string>::const_iterator iter = value.begin(); | 748 for (std::set<std::string>::const_iterator iter = value.begin(); |
749 iter != value.end(); ++iter) | 749 iter != value.end(); ++iter) |
750 list_value->Append(new base::StringValue(*iter)); | 750 list_value->AppendString(*iter); |
751 | 751 |
752 SetPref(extension_id, pref_path, list_value, msg); | 752 SetPref(extension_id, pref_path, list_value, msg); |
753 } | 753 } |
754 | 754 |
755 void InitPluginService() { | 755 void InitPluginService() { |
756 #if defined(ENABLE_PLUGINS) | 756 #if defined(ENABLE_PLUGINS) |
757 PluginService::GetInstance()->Init(); | 757 PluginService::GetInstance()->Init(); |
758 #endif | 758 #endif |
759 } | 759 } |
760 | 760 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 // updating the browser to a version which recognizes additional host | 1637 // updating the browser to a version which recognizes additional host |
1638 // permissions). | 1638 // permissions). |
1639 host_permissions.clear(); | 1639 host_permissions.clear(); |
1640 current_perms = NULL; | 1640 current_perms = NULL; |
1641 | 1641 |
1642 host_permissions.insert("http://*.google.com/*"); | 1642 host_permissions.insert("http://*.google.com/*"); |
1643 host_permissions.insert("https://*.google.com/*"); | 1643 host_permissions.insert("https://*.google.com/*"); |
1644 host_permissions.insert("http://*.google.com.hk/*"); | 1644 host_permissions.insert("http://*.google.com.hk/*"); |
1645 | 1645 |
1646 base::ListValue* api_permissions = new base::ListValue(); | 1646 base::ListValue* api_permissions = new base::ListValue(); |
1647 api_permissions->Append( | 1647 api_permissions->AppendString("tabs"); |
1648 new base::StringValue("tabs")); | |
1649 SetPref(extension_id, "granted_permissions.api", | 1648 SetPref(extension_id, "granted_permissions.api", |
1650 api_permissions, "granted_permissions.api"); | 1649 api_permissions, "granted_permissions.api"); |
1651 SetPrefStringSet( | 1650 SetPrefStringSet( |
1652 extension_id, "granted_permissions.scriptable_host", host_permissions); | 1651 extension_id, "granted_permissions.scriptable_host", host_permissions); |
1653 | 1652 |
1654 service()->ReloadExtensionsForTest(); | 1653 service()->ReloadExtensionsForTest(); |
1655 | 1654 |
1656 EXPECT_EQ(1u, registry()->disabled_extensions().size()); | 1655 EXPECT_EQ(1u, registry()->disabled_extensions().size()); |
1657 extension = registry()->disabled_extensions().begin()->get(); | 1656 extension = registry()->disabled_extensions().begin()->get(); |
1658 | 1657 |
(...skipping 4992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6651 | 6650 |
6652 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6651 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
6653 content::Source<Profile>(profile()), | 6652 content::Source<Profile>(profile()), |
6654 content::NotificationService::NoDetails()); | 6653 content::NotificationService::NoDetails()); |
6655 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6654 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
6656 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6655 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
6657 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6656 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
6658 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6657 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
6659 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6658 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
6660 } | 6659 } |
OLD | NEW |