| 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/extension.h" | 5 #include "extensions/common/extension.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 install_warnings_.push_back(new_warning); | 404 install_warnings_.push_back(new_warning); |
| 405 } | 405 } |
| 406 | 406 |
| 407 void Extension::AddInstallWarnings( | 407 void Extension::AddInstallWarnings( |
| 408 const std::vector<InstallWarning>& new_warnings) { | 408 const std::vector<InstallWarning>& new_warnings) { |
| 409 install_warnings_.insert(install_warnings_.end(), | 409 install_warnings_.insert(install_warnings_.end(), |
| 410 new_warnings.begin(), new_warnings.end()); | 410 new_warnings.begin(), new_warnings.end()); |
| 411 } | 411 } |
| 412 | 412 |
| 413 bool Extension::is_app() const { | 413 bool Extension::is_app() const { |
| 414 return manifest_->is_app(); | 414 return manifest()->is_app(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool Extension::is_platform_app() const { | 417 bool Extension::is_platform_app() const { |
| 418 return manifest_->is_platform_app(); | 418 return manifest()->is_platform_app(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 bool Extension::is_hosted_app() const { | 421 bool Extension::is_hosted_app() const { |
| 422 return manifest()->is_hosted_app(); | 422 return manifest()->is_hosted_app(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 bool Extension::is_legacy_packaged_app() const { | 425 bool Extension::is_legacy_packaged_app() const { |
| 426 return manifest()->is_legacy_packaged_app(); | 426 return manifest()->is_legacy_packaged_app(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 bool Extension::is_extension() const { | 429 bool Extension::is_extension() const { |
| 430 return manifest()->is_extension(); | 430 return manifest()->is_extension(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 bool Extension::is_shared_module() const { |
| 434 return manifest()->is_shared_module(); |
| 435 } |
| 436 |
| 437 bool Extension::is_theme() const { |
| 438 return manifest()->is_theme(); |
| 439 } |
| 440 |
| 433 bool Extension::can_be_incognito_enabled() const { | 441 bool Extension::can_be_incognito_enabled() const { |
| 434 // Only component platform apps are supported in incognito. | 442 // Only component platform apps are supported in incognito. |
| 435 return !is_platform_app() || location() == Manifest::COMPONENT; | 443 return !is_platform_app() || location() == Manifest::COMPONENT; |
| 436 } | 444 } |
| 437 | 445 |
| 438 void Extension::AddWebExtentPattern(const URLPattern& pattern) { | 446 void Extension::AddWebExtentPattern(const URLPattern& pattern) { |
| 439 // Bookmark apps are permissionless. | 447 // Bookmark apps are permissionless. |
| 440 if (from_bookmark()) | 448 if (from_bookmark()) |
| 441 return; | 449 return; |
| 442 | 450 |
| 443 extent_.AddPattern(pattern); | 451 extent_.AddPattern(pattern); |
| 444 } | 452 } |
| 445 | 453 |
| 446 bool Extension::is_theme() const { | |
| 447 return manifest()->is_theme(); | |
| 448 } | |
| 449 | |
| 450 // static | 454 // static |
| 451 bool Extension::InitExtensionID(extensions::Manifest* manifest, | 455 bool Extension::InitExtensionID(extensions::Manifest* manifest, |
| 452 const base::FilePath& path, | 456 const base::FilePath& path, |
| 453 const std::string& explicit_id, | 457 const std::string& explicit_id, |
| 454 int creation_flags, | 458 int creation_flags, |
| 455 base::string16* error) { | 459 base::string16* error) { |
| 456 if (!explicit_id.empty()) { | 460 if (!explicit_id.empty()) { |
| 457 manifest->set_extension_id(explicit_id); | 461 manifest->set_extension_id(explicit_id); |
| 458 return true; | 462 return true; |
| 459 } | 463 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 779 |
| 776 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 780 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 777 const Extension* extension, | 781 const Extension* extension, |
| 778 const PermissionSet* permissions, | 782 const PermissionSet* permissions, |
| 779 Reason reason) | 783 Reason reason) |
| 780 : reason(reason), | 784 : reason(reason), |
| 781 extension(extension), | 785 extension(extension), |
| 782 permissions(permissions) {} | 786 permissions(permissions) {} |
| 783 | 787 |
| 784 } // namespace extensions | 788 } // namespace extensions |
| OLD | NEW |