| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/common/permissions/permission_message_provider.h" | 5 #include "extensions/common/permissions/permission_message_provider.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "extensions/common/extensions_client.h" | 9 #include "extensions/common/extensions_client.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 ForceForTesting g_force_permission_system_for_testing = | 15 ForceForTesting g_force_permission_system_for_testing = |
| 16 ForceForTesting::DONT_FORCE; | 16 ForceForTesting::DONT_FORCE; |
| 17 | 17 |
| 18 bool IsNewPermissionMessageSystemEnabled() { | 18 bool IsNewPermissionMessageSystemEnabled() { |
| 19 if (g_force_permission_system_for_testing != ForceForTesting::DONT_FORCE) | 19 if (g_force_permission_system_for_testing != ForceForTesting::DONT_FORCE) |
| 20 return g_force_permission_system_for_testing == ForceForTesting::FORCE_NEW; | 20 return g_force_permission_system_for_testing == ForceForTesting::FORCE_NEW; |
| 21 const std::string group_name = | 21 const std::string group_name = |
| 22 base::FieldTrialList::FindFullName("PermissionMessageSystem"); | 22 base::FieldTrialList::FindFullName("PermissionMessageSystem"); |
| 23 return group_name == "NewSystem"; | 23 return group_name != "OldSystem"; |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 void ForcePermissionMessageSystemForTesting( | 28 void ForcePermissionMessageSystemForTesting( |
| 29 ForceForTesting force) { | 29 ForceForTesting force) { |
| 30 g_force_permission_system_for_testing = force; | 30 g_force_permission_system_for_testing = force; |
| 31 } | 31 } |
| 32 | 32 |
| 33 PermissionMessageString::PermissionMessageString( | 33 PermissionMessageString::PermissionMessageString( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 std::vector<base::string16> details = | 75 std::vector<base::string16> details = |
| 76 GetLegacyWarningMessagesDetails(permissions, extension_type); | 76 GetLegacyWarningMessagesDetails(permissions, extension_type); |
| 77 DCHECK_EQ(messages.size(), details.size()); | 77 DCHECK_EQ(messages.size(), details.size()); |
| 78 for (size_t i = 0; i < messages.size(); i++) | 78 for (size_t i = 0; i < messages.size(); i++) |
| 79 strings.push_back(PermissionMessageString(messages[i], details[i])); | 79 strings.push_back(PermissionMessageString(messages[i], details[i])); |
| 80 } | 80 } |
| 81 return strings; | 81 return strings; |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace extensions | 84 } // namespace extensions |
| OLD | NEW |