Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/common/extensions/extension.h

Issue 12316077: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + review comments addressed Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Gets the extension's active permission set. 354 // Gets the extension's active permission set.
355 scoped_refptr<const PermissionSet> GetActivePermissions() const; 355 scoped_refptr<const PermissionSet> GetActivePermissions() const;
356 356
357 // Whether context menu should be shown for page and browser actions. 357 // Whether context menu should be shown for page and browser actions.
358 bool ShowConfigureContextMenus() const; 358 bool ShowConfigureContextMenus() const;
359 359
360 // Returns a list of paths (relative to the extension dir) for images that 360 // Returns a list of paths (relative to the extension dir) for images that
361 // the browser might load (like themes and page action icons). 361 // the browser might load (like themes and page action icons).
362 std::set<base::FilePath> GetBrowserImages() const; 362 std::set<base::FilePath> GetBrowserImages() const;
363 363
364 // Gets the fully resolved absolute launch URL.
365 GURL GetFullLaunchURL() const;
366
367 // Returns true if this extension can execute script on a page. If a 364 // Returns true if this extension can execute script on a page. If a
368 // UserScript object is passed, permission to run that specific script is 365 // UserScript object is passed, permission to run that specific script is
369 // checked (using its matches list). Otherwise, permission to execute script 366 // checked (using its matches list). Otherwise, permission to execute script
370 // programmatically is checked (using the extension's host permission). 367 // programmatically is checked (using the extension's host permission).
371 // 368 //
372 // This method is also aware of certain special pages that extensions are 369 // This method is also aware of certain special pages that extensions are
373 // usually not allowed to run script on. 370 // usually not allowed to run script on.
374 bool CanExecuteScriptOnPage(const GURL& document_url, 371 bool CanExecuteScriptOnPage(const GURL& document_url,
375 const GURL& top_document_url, 372 const GURL& top_document_url,
376 int tab_id, 373 int tab_id,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // App-related. 503 // App-related.
507 bool is_app() const { 504 bool is_app() const {
508 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); 505 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app();
509 } 506 }
510 bool is_platform_app() const; 507 bool is_platform_app() const;
511 bool is_hosted_app() const; 508 bool is_hosted_app() const;
512 bool is_legacy_packaged_app() const; 509 bool is_legacy_packaged_app() const;
513 bool is_extension() const; 510 bool is_extension() const;
514 bool is_storage_isolated() const { return is_storage_isolated_; } 511 bool is_storage_isolated() const { return is_storage_isolated_; }
515 bool can_be_incognito_enabled() const; 512 bool can_be_incognito_enabled() const;
513
514 // TODO(mhx348@motorola.com): Move the below extent related functions to its
515 // ManifestData.
516 void AddWebExtentPattern(const URLPattern& pattern); 516 void AddWebExtentPattern(const URLPattern& pattern);
517 void ClearWebExtentPatterns();
517 const URLPatternSet& web_extent() const { return extent_; } 518 const URLPatternSet& web_extent() const { return extent_; }
518 const std::string& launch_local_path() const { return launch_local_path_; }
519 const std::string& launch_web_url() const { return launch_web_url_; }
520 extension_misc::LaunchContainer launch_container() const {
521 return launch_container_;
522 }
523 int launch_width() const { return launch_width_; }
524 int launch_height() const { return launch_height_; }
525 519
526 // Theme-related. 520 // Theme-related.
527 bool is_theme() const; 521 bool is_theme() const;
528 522
529 // Content pack related. 523 // Content pack related.
530 bool is_content_pack() const; 524 bool is_content_pack() const;
531 ExtensionResource GetContentPackSiteList() const; 525 ExtensionResource GetContentPackSiteList() const;
532 526
533 private: 527 private:
534 friend class base::RefCountedThreadSafe<Extension>; 528 friend class base::RefCountedThreadSafe<Extension>;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 bool LoadRequiredFeatures(string16* error); 588 bool LoadRequiredFeatures(string16* error);
595 bool LoadName(string16* error); 589 bool LoadName(string16* error);
596 bool LoadVersion(string16* error); 590 bool LoadVersion(string16* error);
597 591
598 bool LoadAppFeatures(string16* error); 592 bool LoadAppFeatures(string16* error);
599 bool LoadExtent(const char* key, 593 bool LoadExtent(const char* key,
600 URLPatternSet* extent, 594 URLPatternSet* extent,
601 const char* list_error, 595 const char* list_error,
602 const char* value_error, 596 const char* value_error,
603 string16* error); 597 string16* error);
604 bool LoadLaunchContainer(string16* error);
605 bool LoadLaunchURL(string16* error);
606 598
607 bool LoadSharedFeatures(string16* error); 599 bool LoadSharedFeatures(string16* error);
608 bool LoadDescription(string16* error); 600 bool LoadDescription(string16* error);
609 bool LoadManifestVersion(string16* error); 601 bool LoadManifestVersion(string16* error);
610 bool LoadPlugins(string16* error); 602 bool LoadPlugins(string16* error);
611 bool LoadNaClModules(string16* error); 603 bool LoadNaClModules(string16* error);
612 bool LoadSandboxedPages(string16* error); 604 bool LoadSandboxedPages(string16* error);
613 // Must be called after LoadPlugins(). 605 // Must be called after LoadPlugins().
614 bool LoadRequirements(string16* error); 606 bool LoadRequirements(string16* error);
615 bool LoadOfflineEnabled(string16* error); 607 bool LoadOfflineEnabled(string16* error);
(...skipping 24 matching lines...) Expand all
640 int content_script_index, 632 int content_script_index,
641 const char* globs_property_name, 633 const char* globs_property_name,
642 string16* error, 634 string16* error,
643 void(UserScript::*add_method)(const std::string& glob), 635 void(UserScript::*add_method)(const std::string& glob),
644 UserScript* instance); 636 UserScript* instance);
645 637
646 // Returns true if the extension has more than one "UI surface". For example, 638 // Returns true if the extension has more than one "UI surface". For example,
647 // an extension that has a browser action and a page action. 639 // an extension that has a browser action and a page action.
648 bool HasMultipleUISurfaces() const; 640 bool HasMultipleUISurfaces() const;
649 641
650 // Updates the launch URL and extents for the extension using the given
651 // |override_url|.
652 void OverrideLaunchUrl(const GURL& override_url);
653
654 // Custom checks for the experimental permission that can't be expressed in 642 // Custom checks for the experimental permission that can't be expressed in
655 // _permission_features.json. 643 // _permission_features.json.
656 bool CanSpecifyExperimentalPermission() const; 644 bool CanSpecifyExperimentalPermission() const;
657 645
658 // Checks whether the host |pattern| is allowed for this extension, given API 646 // Checks whether the host |pattern| is allowed for this extension, given API
659 // permissions |permissions|. 647 // permissions |permissions|.
660 bool CanSpecifyHostPermission(const URLPattern& pattern, 648 bool CanSpecifyHostPermission(const URLPattern& pattern,
661 const APIPermissionSet& permissions) const; 649 const APIPermissionSet& permissions) const;
662 650
663 bool CheckMinimumChromeVersion(string16* error) const; 651 bool CheckMinimumChromeVersion(string16* error) const;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 bool finished_parsing_manifest_; 757 bool finished_parsing_manifest_;
770 758
771 // Ensures that any call to GetManifestData() prior to finishing 759 // Ensures that any call to GetManifestData() prior to finishing
772 // initialization happens from the same thread (this can happen when certain 760 // initialization happens from the same thread (this can happen when certain
773 // parts of the initialization process need information from previous parts). 761 // parts of the initialization process need information from previous parts).
774 base::ThreadChecker thread_checker_; 762 base::ThreadChecker thread_checker_;
775 763
776 // Whether this extension requests isolated storage. 764 // Whether this extension requests isolated storage.
777 bool is_storage_isolated_; 765 bool is_storage_isolated_;
778 766
779 // The local path inside the extension to use with the launcher.
780 std::string launch_local_path_;
781
782 // A web url to use with the launcher. Note that this might be relative or
783 // absolute. If relative, it is relative to web_origin.
784 std::string launch_web_url_;
785
786 // The window type that an app's manifest specifies to launch into.
787 // This is not always the window type an app will open into, because
788 // users can override the way each app launches. See
789 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
790 // to decide what container an app will launch in.
791 extension_misc::LaunchContainer launch_container_;
792
793 // The default size of the container when launching. Only respected for
794 // containers like panels and windows.
795 int launch_width_;
796 int launch_height_;
797
798 // Should this app be shown in the app launcher. 767 // Should this app be shown in the app launcher.
799 bool display_in_launcher_; 768 bool display_in_launcher_;
800 769
801 // Should this app be shown in the browser New Tab Page. 770 // Should this app be shown in the browser New Tab Page.
802 bool display_in_new_tab_page_; 771 bool display_in_new_tab_page_;
803 772
804 // Whether the extension has host permissions or user script patterns that 773 // Whether the extension has host permissions or user script patterns that
805 // imply access to file:/// scheme URLs (the user may not have actually 774 // imply access to file:/// scheme URLs (the user may not have actually
806 // granted it that access). 775 // granted it that access).
807 bool wants_file_access_; 776 bool wants_file_access_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 835
867 UpdatedExtensionPermissionsInfo( 836 UpdatedExtensionPermissionsInfo(
868 const Extension* extension, 837 const Extension* extension,
869 const PermissionSet* permissions, 838 const PermissionSet* permissions,
870 Reason reason); 839 Reason reason);
871 }; 840 };
872 841
873 } // namespace extensions 842 } // namespace extensions
874 843
875 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 844 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698