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

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

Issue 322893002: Cleanup: Make ExtensionService::OnExtensionInstalled take a bitmask instead of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more win compile fixes Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/prefs/pref_change_registrar.h" 18 #include "base/prefs/pref_change_registrar.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "chrome/browser/extensions/blacklist.h" 20 #include "chrome/browser/extensions/blacklist.h"
21 #include "chrome/browser/extensions/pending_extension_manager.h" 21 #include "chrome/browser/extensions/pending_extension_manager.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "extensions/browser/external_provider_interface.h" 24 #include "extensions/browser/external_provider_interface.h"
25 #include "extensions/browser/install_flag.h"
25 #include "extensions/browser/management_policy.h" 26 #include "extensions/browser/management_policy.h"
26 #include "extensions/browser/process_manager.h" 27 #include "extensions/browser/process_manager.h"
27 #include "extensions/common/extension.h" 28 #include "extensions/common/extension.h"
28 #include "extensions/common/extension_set.h" 29 #include "extensions/common/extension_set.h"
29 #include "extensions/common/manifest.h" 30 #include "extensions/common/manifest.h"
30 #include "sync/api/string_ordinal.h" 31 #include "sync/api/string_ordinal.h"
31 32
32 class ExtensionSyncService; 33 class ExtensionSyncService;
33 class GURL; 34 class GURL;
34 class Profile; 35 class Profile;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void GrantPermissions(const extensions::Extension* extension); 275 void GrantPermissions(const extensions::Extension* extension);
275 276
276 // Check for updates (or potentially new extensions from external providers) 277 // Check for updates (or potentially new extensions from external providers)
277 void CheckForExternalUpdates(); 278 void CheckForExternalUpdates();
278 279
279 // Called when the initial extensions load has completed. 280 // Called when the initial extensions load has completed.
280 virtual void OnLoadedInstalledExtensions(); 281 virtual void OnLoadedInstalledExtensions();
281 282
282 // Informs the service that an extension's files are in place for loading. 283 // Informs the service that an extension's files are in place for loading.
283 // 284 //
284 // |page_ordinal| is the location of the extension in the app launcher. 285 // |extension| the extension
285 // |has_requirement_errors| is true if requirements of the extension weren't 286 // |page_ordinal| the location of the extension in the app launcher
286 // met (for example graphics capabilities). 287 // |install_flags| a bitmask of extensions::InstallFlags
287 // |blacklist_state| will be BLACKLISTED if the extension is blacklisted.
288 // |wait_for_idle| may be false to install the extension immediately.
289 void OnExtensionInstalled(const extensions::Extension* extension, 288 void OnExtensionInstalled(const extensions::Extension* extension,
290 const syncer::StringOrdinal& page_ordinal, 289 const syncer::StringOrdinal& page_ordinal,
291 bool has_requirement_errors, 290 int install_flags);
292 extensions::BlacklistState blacklist_state, 291 void OnExtensionInstalled(const extensions::Extension* extension,
293 bool is_ephemeral, 292 const syncer::StringOrdinal& page_ordinal) {
294 bool wait_for_idle); 293 OnExtensionInstalled(extension,
294 page_ordinal,
295 static_cast<int>(extensions::kInstallFlagNone));
296 }
295 297
296 // Checks for delayed installation for all pending installs. 298 // Checks for delayed installation for all pending installs.
297 void MaybeFinishDelayedInstallations(); 299 void MaybeFinishDelayedInstallations();
298 300
299 // Promotes an ephemeral app to a regular installed app. Ephemeral apps 301 // Promotes an ephemeral app to a regular installed app. Ephemeral apps
300 // are already installed in extension system (albiet transiently) and only 302 // are already installed in extension system (albiet transiently) and only
301 // need to be exposed in the UI. Set |is_from_sync| to true if the 303 // need to be exposed in the UI. Set |is_from_sync| to true if the
302 // install was initiated via sync. 304 // install was initiated via sync.
303 void PromoteEphemeralApp( 305 void PromoteEphemeralApp(
304 const extensions::Extension* extension, bool is_from_sync); 306 const extensions::Extension* extension, bool is_from_sync);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 void TrackTerminatedExtension(const extensions::Extension* extension); 478 void TrackTerminatedExtension(const extensions::Extension* extension);
477 479
478 // Removes the extension with the given id from the list of 480 // Removes the extension with the given id from the list of
479 // terminated extensions if it is there. 481 // terminated extensions if it is there.
480 void UntrackTerminatedExtension(const std::string& id); 482 void UntrackTerminatedExtension(const std::string& id);
481 483
482 // Update preferences for a new or updated extension; notify observers that 484 // Update preferences for a new or updated extension; notify observers that
483 // the extension is installed, e.g., to update event handlers on background 485 // the extension is installed, e.g., to update event handlers on background
484 // pages; and perform other extension install tasks before calling 486 // pages; and perform other extension install tasks before calling
485 // AddExtension. 487 // AddExtension.
488 // |install_flags| is a bitmask of extensions::InstallFlags.
486 void AddNewOrUpdatedExtension(const extensions::Extension* extension, 489 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
487 extensions::Extension::State initial_state, 490 extensions::Extension::State initial_state,
488 extensions::BlacklistState blacklist_state, 491 int install_flags,
489 bool is_ephemeral,
490 const syncer::StringOrdinal& page_ordinal, 492 const syncer::StringOrdinal& page_ordinal,
491 const std::string& install_parameter); 493 const std::string& install_parameter);
492 494
493 // Handles sending notification that |extension| was loaded. 495 // Handles sending notification that |extension| was loaded.
494 void NotifyExtensionLoaded(const extensions::Extension* extension); 496 void NotifyExtensionLoaded(const extensions::Extension* extension);
495 497
496 // Handles sending notification that |extension| was unloaded. 498 // Handles sending notification that |extension| was unloaded.
497 void NotifyExtensionUnloaded( 499 void NotifyExtensionUnloaded(
498 const extensions::Extension* extension, 500 const extensions::Extension* extension,
499 extensions::UnloadedExtensionInfo::Reason reason); 501 extensions::UnloadedExtensionInfo::Reason reason);
(...skipping 16 matching lines...) Expand all
516 // Helper that updates the active extension list used for crash reporting. 518 // Helper that updates the active extension list used for crash reporting.
517 void UpdateActiveExtensionsInCrashReporter(); 519 void UpdateActiveExtensionsInCrashReporter();
518 520
519 // Helper to determine whether we should initially enable an installed 521 // Helper to determine whether we should initially enable an installed
520 // (or upgraded) extension. 522 // (or upgraded) extension.
521 bool ShouldEnableOnInstall(const extensions::Extension* extension); 523 bool ShouldEnableOnInstall(const extensions::Extension* extension);
522 524
523 // Helper to determine if updating an extensions should proceed immediately, 525 // Helper to determine if updating an extensions should proceed immediately,
524 // or if we should delay the update until further notice. 526 // or if we should delay the update until further notice.
525 bool ShouldDelayExtensionUpdate(const std::string& extension_id, 527 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
526 bool wait_for_idle) const; 528 bool install_immediately) const;
527 529
528 // Manages the blacklisted extensions, intended as callback from 530 // Manages the blacklisted extensions, intended as callback from
529 // Blacklist::GetBlacklistedIDs. 531 // Blacklist::GetBlacklistedIDs.
530 void ManageBlacklist( 532 void ManageBlacklist(
531 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids); 533 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
532 534
533 // Add extensions in |blocked| to blacklisted_extensions, remove extensions 535 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
534 // that are neither in |blocked|, nor in |unchanged|. 536 // that are neither in |blocked|, nor in |unchanged|.
535 void UpdateBlockedExtensions(const extensions::ExtensionIdSet& blocked, 537 void UpdateBlockedExtensions(const extensions::ExtensionIdSet& blocked,
536 const extensions::ExtensionIdSet& unchanged); 538 const extensions::ExtensionIdSet& unchanged);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 GreylistedExtensionDisabled); 708 GreylistedExtensionDisabled);
707 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 709 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
708 GreylistDontEnableManuallyDisabled); 710 GreylistDontEnableManuallyDisabled);
709 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 711 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
710 GreylistUnknownDontChange); 712 GreylistUnknownDontChange);
711 713
712 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 714 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
713 }; 715 };
714 716
715 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 717 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698