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

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 8862007: Installing a platform application will add all application shortucts. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't do it for mac Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/extensions/extension_process_manager.h" 30 #include "chrome/browser/extensions/extension_process_manager.h"
31 #include "chrome/browser/extensions/extension_sync_data.h" 31 #include "chrome/browser/extensions/extension_sync_data.h"
32 #include "chrome/browser/extensions/extension_toolbar_model.h" 32 #include "chrome/browser/extensions/extension_toolbar_model.h"
33 #include "chrome/browser/extensions/extension_warning_set.h" 33 #include "chrome/browser/extensions/extension_warning_set.h"
34 #include "chrome/browser/extensions/extensions_quota_service.h" 34 #include "chrome/browser/extensions/extensions_quota_service.h"
35 #include "chrome/browser/extensions/external_extension_provider_interface.h" 35 #include "chrome/browser/extensions/external_extension_provider_interface.h"
36 #include "chrome/browser/extensions/pending_extension_manager.h" 36 #include "chrome/browser/extensions/pending_extension_manager.h"
37 #include "chrome/browser/extensions/process_map.h" 37 #include "chrome/browser/extensions/process_map.h"
38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" 38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
39 #include "chrome/browser/prefs/pref_change_registrar.h" 39 #include "chrome/browser/prefs/pref_change_registrar.h"
40 #include "chrome/browser/shell_integration.h"
40 #include "chrome/browser/sync/api/sync_change.h" 41 #include "chrome/browser/sync/api/sync_change.h"
41 #include "chrome/browser/sync/api/syncable_service.h" 42 #include "chrome/browser/sync/api/syncable_service.h"
42 #include "chrome/common/extensions/extension.h" 43 #include "chrome/common/extensions/extension.h"
43 #include "chrome/common/extensions/extension_constants.h" 44 #include "chrome/common/extensions/extension_constants.h"
44 #include "chrome/common/extensions/extension_set.h" 45 #include "chrome/common/extensions/extension_set.h"
45 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
46 #include "content/public/browser/notification_observer.h" 47 #include "content/public/browser/notification_observer.h"
47 #include "content/public/browser/notification_registrar.h" 48 #include "content/public/browser/notification_registrar.h"
48 49
49 class AppNotificationManager; 50 class AppNotificationManager;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 extension_misc::UnloadedExtensionReason reason) = 0; 124 extension_misc::UnloadedExtensionReason reason) = 0;
124 125
125 virtual bool is_ready() = 0; 126 virtual bool is_ready() = 0;
126 }; 127 };
127 128
128 // Manages installed and running Chromium extensions. 129 // Manages installed and running Chromium extensions.
129 class ExtensionService 130 class ExtensionService
130 : public ExtensionServiceInterface, 131 : public ExtensionServiceInterface,
131 public ExternalExtensionProviderInterface::VisitorInterface, 132 public ExternalExtensionProviderInterface::VisitorInterface,
132 public base::SupportsWeakPtr<ExtensionService>, 133 public base::SupportsWeakPtr<ExtensionService>,
133 public content::NotificationObserver { 134 public content::NotificationObserver,
135 public ImageLoadingTracker::Observer {
134 public: 136 public:
135 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr; 137 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr;
136 138
137 // The name of the directory inside the profile where extensions are 139 // The name of the directory inside the profile where extensions are
138 // installed to. 140 // installed to.
139 static const char* kInstallDirectoryName; 141 static const char* kInstallDirectoryName;
140 142
141 // If auto-updates are turned on, default to running every 5 hours. 143 // If auto-updates are turned on, default to running every 5 hours.
142 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; 144 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5;
143 145
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 #if defined(UNIT_TEST) 564 #if defined(UNIT_TEST)
563 void TrackTerminatedExtensionForTest(const Extension* extension) { 565 void TrackTerminatedExtensionForTest(const Extension* extension) {
564 TrackTerminatedExtension(extension); 566 TrackTerminatedExtension(extension);
565 } 567 }
566 #endif 568 #endif
567 569
568 ExtensionWarningSet* extension_warnings() { 570 ExtensionWarningSet* extension_warnings() {
569 return &extension_warnings_; 571 return &extension_warnings_;
570 } 572 }
571 573
574 // Implement ImageLoadingTracker::Observer. |tracker_| is used to
575 // load the application's icon, which is done when we start creating an
576 // application's shortcuts. This method receives the icon, and completes
577 // the process of installing the shortcuts.
578 virtual void OnImageLoaded(SkBitmap* image,
579 const ExtensionResource& resource,
580 int index) OVERRIDE;
572 private: 581 private:
573 // Bundle of type (app or extension)-specific sync stuff. 582 // Bundle of type (app or extension)-specific sync stuff.
574 struct SyncBundle { 583 struct SyncBundle {
575 SyncBundle(); 584 SyncBundle();
576 ~SyncBundle(); 585 ~SyncBundle();
577 586
578 bool HasExtensionId(const std::string& id) const; 587 bool HasExtensionId(const std::string& id) const;
579 bool HasPendingExtensionId(const std::string& id) const; 588 bool HasPendingExtensionId(const std::string& id) const;
580 589
581 ExtensionFilter filter; 590 ExtensionFilter filter;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // type, just the ones that are responsible for rendering a particular MIME 685 // type, just the ones that are responsible for rendering a particular MIME
677 // type, like application/pdf. Note: We only register NaCl modules in the 686 // type, like application/pdf. Note: We only register NaCl modules in the
678 // browser process. 687 // browser process.
679 void RegisterNaClModule(const GURL& url, const std::string& mime_type); 688 void RegisterNaClModule(const GURL& url, const std::string& mime_type);
680 void UnregisterNaClModule(const GURL& url); 689 void UnregisterNaClModule(const GURL& url);
681 690
682 // Call UpdatePluginListWithNaClModules() after registering or unregistering 691 // Call UpdatePluginListWithNaClModules() after registering or unregistering
683 // a NaCl module to see those changes reflected in the PluginList. 692 // a NaCl module to see those changes reflected in the PluginList.
684 void UpdatePluginListWithNaClModules(); 693 void UpdatePluginListWithNaClModules();
685 694
695 // Start the process of installing an application shortcut.
696 // The process is finished when OnImageLoaded is called.
697 void StartInstallApplicationShortcut(const Extension* extension);
698
686 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); 699 NaClModuleInfoList::iterator FindNaClModule(const GURL& url);
687 700
688 // The profile this ExtensionService is part of. 701 // The profile this ExtensionService is part of.
689 Profile* profile_; 702 Profile* profile_;
690 703
691 // Preferences for the owning profile (weak reference). 704 // Preferences for the owning profile (weak reference).
692 ExtensionPrefs* extension_prefs_; 705 ExtensionPrefs* extension_prefs_;
693 706
694 // Settings for the owning profile. 707 // Settings for the owning profile.
695 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 708 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 NaClModuleInfoList nacl_module_list_; 827 NaClModuleInfoList nacl_module_list_;
815 828
816 SyncBundle app_sync_bundle_; 829 SyncBundle app_sync_bundle_;
817 SyncBundle extension_sync_bundle_; 830 SyncBundle extension_sync_bundle_;
818 831
819 // Contains an entry for each warning that shall be currently shown. 832 // Contains an entry for each warning that shall be currently shown.
820 ExtensionWarningSet extension_warnings_; 833 ExtensionWarningSet extension_warnings_;
821 834
822 extensions::ProcessMap process_map_; 835 extensions::ProcessMap process_map_;
823 836
837 // Fields used when installing application shortcuts.
838 ShellIntegration::ShortcutInfo shortcut_info_;
839 ImageLoadingTracker tracker_;
840
824 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 841 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
825 InstallAppsWithUnlimtedStorage); 842 InstallAppsWithUnlimtedStorage);
826 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 843 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
827 InstallAppsAndCheckStorageProtection); 844 InstallAppsAndCheckStorageProtection);
828 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 845 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
829 }; 846 };
830 847
831 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 848 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/extensions/extension_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698