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

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

Issue 14241002: 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: Created 7 years, 8 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Gets the extension's active permission set. 306 // Gets the extension's active permission set.
307 scoped_refptr<const PermissionSet> GetActivePermissions() const; 307 scoped_refptr<const PermissionSet> GetActivePermissions() const;
308 308
309 // Whether context menu should be shown for page and browser actions. 309 // Whether context menu should be shown for page and browser actions.
310 bool ShowConfigureContextMenus() const; 310 bool ShowConfigureContextMenus() const;
311 311
312 // Returns a list of paths (relative to the extension dir) for images that 312 // Returns a list of paths (relative to the extension dir) for images that
313 // the browser might load (like themes and page action icons). 313 // the browser might load (like themes and page action icons).
314 std::set<base::FilePath> GetBrowserImages() const; 314 std::set<base::FilePath> GetBrowserImages() const;
315 315
316 // Gets the fully resolved absolute launch URL.
317 GURL GetFullLaunchURL() const;
318
319 // Returns true if this extension can execute script on a page. If a 316 // Returns true if this extension can execute script on a page. If a
320 // UserScript object is passed, permission to run that specific script is 317 // UserScript object is passed, permission to run that specific script is
321 // checked (using its matches list). Otherwise, permission to execute script 318 // checked (using its matches list). Otherwise, permission to execute script
322 // programmatically is checked (using the extension's host permission). 319 // programmatically is checked (using the extension's host permission).
323 // 320 //
324 // This method is also aware of certain special pages that extensions are 321 // This method is also aware of certain special pages that extensions are
325 // usually not allowed to run script on. 322 // usually not allowed to run script on.
326 bool CanExecuteScriptOnPage(const GURL& document_url, 323 bool CanExecuteScriptOnPage(const GURL& document_url,
327 const GURL& top_document_url, 324 const GURL& top_document_url,
328 int tab_id, 325 int tab_id,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; 447 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0;
451 } 448 }
452 449
453 // App-related. 450 // App-related.
454 bool is_app() const; 451 bool is_app() const;
455 bool is_platform_app() const; 452 bool is_platform_app() const;
456 bool is_hosted_app() const; 453 bool is_hosted_app() const;
457 bool is_legacy_packaged_app() const; 454 bool is_legacy_packaged_app() const;
458 bool is_extension() const; 455 bool is_extension() const;
459 bool can_be_incognito_enabled() const; 456 bool can_be_incognito_enabled() const;
457
458 // TODO(c.joethomas@gmail.com): Move the below extent related functions to its
459 // ManifestData.
460 void AddWebExtentPattern(const URLPattern& pattern); 460 void AddWebExtentPattern(const URLPattern& pattern);
461 void ClearWebExtentPatterns();
461 const URLPatternSet& web_extent() const { return extent_; } 462 const URLPatternSet& web_extent() const { return extent_; }
462 const std::string& launch_local_path() const { return launch_local_path_; }
463 const std::string& launch_web_url() const { return launch_web_url_; }
464 extension_misc::LaunchContainer launch_container() const {
465 return launch_container_;
466 }
467 int launch_width() const { return launch_width_; }
468 int launch_height() const { return launch_height_; }
469 463
470 // Theme-related. 464 // Theme-related.
471 bool is_theme() const; 465 bool is_theme() const;
472 466
473 private: 467 private:
474 friend class base::RefCountedThreadSafe<Extension>; 468 friend class base::RefCountedThreadSafe<Extension>;
475 469
476 class RuntimeData { 470 class RuntimeData {
477 public: 471 public:
478 RuntimeData(); 472 RuntimeData();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 bool LoadRequiredFeatures(string16* error); 524 bool LoadRequiredFeatures(string16* error);
531 bool LoadName(string16* error); 525 bool LoadName(string16* error);
532 bool LoadVersion(string16* error); 526 bool LoadVersion(string16* error);
533 527
534 bool LoadAppFeatures(string16* error); 528 bool LoadAppFeatures(string16* error);
535 bool LoadExtent(const char* key, 529 bool LoadExtent(const char* key,
536 URLPatternSet* extent, 530 URLPatternSet* extent,
537 const char* list_error, 531 const char* list_error,
538 const char* value_error, 532 const char* value_error,
539 string16* error); 533 string16* error);
540 bool LoadLaunchContainer(string16* error);
541 bool LoadLaunchURL(string16* error);
542 534
543 bool LoadSharedFeatures(string16* error); 535 bool LoadSharedFeatures(string16* error);
544 bool LoadDescription(string16* error); 536 bool LoadDescription(string16* error);
545 bool LoadManifestVersion(string16* error); 537 bool LoadManifestVersion(string16* error);
546 bool LoadNaClModules(string16* error); 538 bool LoadNaClModules(string16* error);
547 539
548 // Returns true if the extension has more than one "UI surface". For example, 540 // Returns true if the extension has more than one "UI surface". For example,
549 // an extension that has a browser action and a page action. 541 // an extension that has a browser action and a page action.
550 bool HasMultipleUISurfaces() const; 542 bool HasMultipleUISurfaces() const;
551 543
552 // Updates the launch URL and extents for the extension using the given
553 // |override_url|.
554 void OverrideLaunchUrl(const GURL& override_url);
555
556 // Custom checks for the experimental permission that can't be expressed in 544 // Custom checks for the experimental permission that can't be expressed in
557 // _permission_features.json. 545 // _permission_features.json.
558 bool CanSpecifyExperimentalPermission() const; 546 bool CanSpecifyExperimentalPermission() const;
559 547
560 // Checks whether the host |pattern| is allowed for this extension, given API 548 // Checks whether the host |pattern| is allowed for this extension, given API
561 // permissions |permissions|. 549 // permissions |permissions|.
562 bool CanSpecifyHostPermission(const URLPattern& pattern, 550 bool CanSpecifyHostPermission(const URLPattern& pattern,
563 const APIPermissionSet& permissions) const; 551 const APIPermissionSet& permissions) const;
564 552
565 bool CheckMinimumChromeVersion(string16* error) const; 553 bool CheckMinimumChromeVersion(string16* error) const;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 ManifestDataMap manifest_data_; 625 ManifestDataMap manifest_data_;
638 626
639 // Set to true at the end of InitValue when initialization is finished. 627 // Set to true at the end of InitValue when initialization is finished.
640 bool finished_parsing_manifest_; 628 bool finished_parsing_manifest_;
641 629
642 // Ensures that any call to GetManifestData() prior to finishing 630 // Ensures that any call to GetManifestData() prior to finishing
643 // initialization happens from the same thread (this can happen when certain 631 // initialization happens from the same thread (this can happen when certain
644 // parts of the initialization process need information from previous parts). 632 // parts of the initialization process need information from previous parts).
645 base::ThreadChecker thread_checker_; 633 base::ThreadChecker thread_checker_;
646 634
647 // The local path inside the extension to use with the launcher.
648 std::string launch_local_path_;
649
650 // A web url to use with the launcher. Note that this might be relative or
651 // absolute. If relative, it is relative to web_origin.
652 std::string launch_web_url_;
653
654 // The window type that an app's manifest specifies to launch into.
655 // This is not always the window type an app will open into, because
656 // users can override the way each app launches. See
657 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
658 // to decide what container an app will launch in.
659 extension_misc::LaunchContainer launch_container_;
660
661 // The default size of the container when launching. Only respected for
662 // containers like panels and windows.
663 int launch_width_;
664 int launch_height_;
665
666 // Should this app be shown in the app launcher. 635 // Should this app be shown in the app launcher.
667 bool display_in_launcher_; 636 bool display_in_launcher_;
668 637
669 // Should this app be shown in the browser New Tab Page. 638 // Should this app be shown in the browser New Tab Page.
670 bool display_in_new_tab_page_; 639 bool display_in_new_tab_page_;
671 640
672 // Whether the extension has host permissions or user script patterns that 641 // Whether the extension has host permissions or user script patterns that
673 // imply access to file:/// scheme URLs (the user may not have actually 642 // imply access to file:/// scheme URLs (the user may not have actually
674 // granted it that access). 643 // granted it that access).
675 bool wants_file_access_; 644 bool wants_file_access_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 703
735 UpdatedExtensionPermissionsInfo( 704 UpdatedExtensionPermissionsInfo(
736 const Extension* extension, 705 const Extension* extension,
737 const PermissionSet* permissions, 706 const PermissionSet* permissions,
738 Reason reason); 707 Reason reason);
739 }; 708 };
740 709
741 } // namespace extensions 710 } // namespace extensions
742 711
743 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 712 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698