| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
| 7 #include "chrome/browser/extensions/permissions_updater.h" | 7 #include "chrome/browser/extensions/permissions_updater.h" |
| 8 #include "chrome/browser/extensions/test_extension_environment.h" | 8 #include "chrome/browser/extensions/test_extension_environment.h" |
| 9 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" | 9 #include "chrome/common/extensions/permissions/chrome_permission_message_provide
r.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return GetMessages(PermissionsParser::GetRequiredPermissions(app_.get())); | 106 return GetMessages(PermissionsParser::GetRequiredPermissions(app_.get())); |
| 107 } | 107 } |
| 108 | 108 |
| 109 std::vector<base::string16> optional_permissions() { | 109 std::vector<base::string16> optional_permissions() { |
| 110 return GetMessages(PermissionsParser::GetOptionalPermissions(app_.get())); | 110 return GetMessages(PermissionsParser::GetOptionalPermissions(app_.get())); |
| 111 } | 111 } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 std::vector<base::string16> GetMessages( | 114 std::vector<base::string16> GetMessages( |
| 115 scoped_refptr<const PermissionSet> permissions) { | 115 scoped_refptr<const PermissionSet> permissions) { |
| 116 return message_provider_->GetWarningMessages(permissions.get(), | 116 return message_provider_->GetLegacyWarningMessages(permissions.get(), |
| 117 app_->GetType()); | 117 app_->GetType()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 extensions::TestExtensionEnvironment env_; | 120 extensions::TestExtensionEnvironment env_; |
| 121 scoped_ptr<ChromePermissionMessageProvider> message_provider_; | 121 scoped_ptr<ChromePermissionMessageProvider> message_provider_; |
| 122 scoped_refptr<const Extension> app_; | 122 scoped_refptr<const Extension> app_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(PermissionMessagesUnittest); | 124 DISALLOW_COPY_AND_ASSIGN(PermissionMessagesUnittest); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 // If an app has both the 'history' and 'tabs' permission, one should hide the | 127 // If an app has both the 'history' and 'tabs' permission, one should hide the |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 GrantOptionalPermissions(); | 245 GrantOptionalPermissions(); |
| 246 | 246 |
| 247 ASSERT_EQ(1U, active_permissions().size()); | 247 ASSERT_EQ(1U, active_permissions().size()); |
| 248 EXPECT_EQ(l10n_util::GetStringUTF16( | 248 EXPECT_EQ(l10n_util::GetStringUTF16( |
| 249 IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ_AND_SESSIONS), | 249 IDS_EXTENSION_PROMPT_WARNING_HISTORY_READ_AND_SESSIONS), |
| 250 active_permissions()[0]); | 250 active_permissions()[0]); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace extensions | 253 } // namespace extensions |
| OLD | NEW |