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 "extensions/common/permissions/permissions_data.h" | 5 #include "extensions/common/permissions/permissions_data.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/url_constants.h" | 8 #include "content/public/common/url_constants.h" |
9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
10 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 bool PermissionsData::HasEffectiveAccessToAllHosts() const { | 181 bool PermissionsData::HasEffectiveAccessToAllHosts() const { |
182 return active_permissions()->HasEffectiveAccessToAllHosts(); | 182 return active_permissions()->HasEffectiveAccessToAllHosts(); |
183 } | 183 } |
184 | 184 |
185 PermissionMessages PermissionsData::GetPermissionMessages() const { | 185 PermissionMessages PermissionsData::GetPermissionMessages() const { |
186 if (ShouldSkipPermissionWarnings(extension_id_)) { | 186 if (ShouldSkipPermissionWarnings(extension_id_)) { |
187 return PermissionMessages(); | 187 return PermissionMessages(); |
188 } else { | 188 } else { |
189 return PermissionMessageProvider::Get()->GetPermissionMessages( | 189 return PermissionMessageProvider::Get()->GetPermissionMessages( |
190 active_permissions(), manifest_type_); | 190 active_permissions().get(), manifest_type_); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 std::vector<base::string16> PermissionsData::GetPermissionMessageStrings() | 194 std::vector<base::string16> PermissionsData::GetPermissionMessageStrings() |
195 const { | 195 const { |
196 if (ShouldSkipPermissionWarnings(extension_id_)) | 196 if (ShouldSkipPermissionWarnings(extension_id_)) |
197 return std::vector<base::string16>(); | 197 return std::vector<base::string16>(); |
198 return PermissionMessageProvider::Get()->GetWarningMessages( | 198 return PermissionMessageProvider::Get()->GetWarningMessages( |
199 active_permissions(), manifest_type_); | 199 active_permissions().get(), manifest_type_); |
200 } | 200 } |
201 | 201 |
202 std::vector<base::string16> | 202 std::vector<base::string16> |
203 PermissionsData::GetPermissionMessageDetailsStrings() const { | 203 PermissionsData::GetPermissionMessageDetailsStrings() const { |
204 if (ShouldSkipPermissionWarnings(extension_id_)) | 204 if (ShouldSkipPermissionWarnings(extension_id_)) |
205 return std::vector<base::string16>(); | 205 return std::vector<base::string16>(); |
206 return PermissionMessageProvider::Get()->GetWarningMessagesDetails( | 206 return PermissionMessageProvider::Get()->GetWarningMessagesDetails( |
207 active_permissions(), manifest_type_); | 207 active_permissions().get(), manifest_type_); |
208 } | 208 } |
209 | 209 |
210 bool PermissionsData::HasWithheldImpliedAllHosts() const { | 210 bool PermissionsData::HasWithheldImpliedAllHosts() const { |
211 // Since we currently only withhold all_hosts, it's sufficient to check | 211 // Since we currently only withhold all_hosts, it's sufficient to check |
212 // that either set is not empty. | 212 // that either set is not empty. |
213 return !withheld_permissions()->explicit_hosts().is_empty() || | 213 return !withheld_permissions()->explicit_hosts().is_empty() || |
214 !withheld_permissions()->scriptable_hosts().is_empty(); | 214 !withheld_permissions()->scriptable_hosts().is_empty(); |
215 } | 215 } |
216 | 216 |
217 bool PermissionsData::CanAccessPage(const Extension* extension, | 217 bool PermissionsData::CanAccessPage(const Extension* extension, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return ACCESS_WITHHELD; | 360 return ACCESS_WITHHELD; |
361 | 361 |
362 if (error) { | 362 if (error) { |
363 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, | 363 *error = ErrorUtils::FormatErrorMessage(manifest_errors::kCannotAccessPage, |
364 document_url.spec()); | 364 document_url.spec()); |
365 } | 365 } |
366 return ACCESS_DENIED; | 366 return ACCESS_DENIED; |
367 } | 367 } |
368 | 368 |
369 } // namespace extensions | 369 } // namespace extensions |
OLD | NEW |