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

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

Issue 14973007: Auto-install/uninstall shared module dependencies for extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more feedback Created 7 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
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_PREFS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 LAUNCH_REGULAR, 76 LAUNCH_REGULAR,
77 LAUNCH_FULLSCREEN, 77 LAUNCH_FULLSCREEN,
78 LAUNCH_WINDOW, 78 LAUNCH_WINDOW,
79 79
80 // Launch an app in the in the way a click on the NTP would, 80 // Launch an app in the in the way a click on the NTP would,
81 // if no user pref were set. Update this constant to change 81 // if no user pref were set. Update this constant to change
82 // the default for the NTP and chrome.management.launchApp(). 82 // the default for the NTP and chrome.management.launchApp().
83 LAUNCH_DEFAULT = LAUNCH_REGULAR 83 LAUNCH_DEFAULT = LAUNCH_REGULAR
84 }; 84 };
85 85
86 // This enum is used to store the reason an extension's install has been
87 // delayed. Do not remove items or re-order this enum as it is used in
88 // preferences.
89 enum DelayReason {
90 DELAY_REASON_NONE = 0,
91 DELAY_REASON_GC = 1,
92 DELAY_REASON_WAIT_FOR_IDLE = 2,
93 DELAY_REASON_WAIT_FOR_IMPORTS = 3,
94 };
95
96
86 // Creates base::Time classes. The default implementation is just to return 97 // Creates base::Time classes. The default implementation is just to return
87 // the current time, but tests can inject alternative implementations. 98 // the current time, but tests can inject alternative implementations.
88 class TimeProvider { 99 class TimeProvider {
89 public: 100 public:
90 TimeProvider(); 101 TimeProvider();
91 102
92 virtual ~TimeProvider(); 103 virtual ~TimeProvider();
93 104
94 // By default, returns the current time (base::Time::Now()). 105 // By default, returns the current time (base::Time::Now()).
95 virtual base::Time GetCurrentTime() const; 106 virtual base::Time GetCurrentTime() const;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // and neither will external extensions the user has explicitly uninstalled. 400 // and neither will external extensions the user has explicitly uninstalled.
390 // Caller takes ownership of returned structure. 401 // Caller takes ownership of returned structure.
391 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; 402 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const;
392 403
393 // Returns the ExtensionInfo from the prefs for the given extension. If the 404 // Returns the ExtensionInfo from the prefs for the given extension. If the
394 // extension is not present, NULL is returned. 405 // extension is not present, NULL is returned.
395 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( 406 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo(
396 const std::string& extension_id) const; 407 const std::string& extension_id) const;
397 408
398 // We've downloaded an updated .crx file for the extension, but are waiting 409 // We've downloaded an updated .crx file for the extension, but are waiting
399 // for idle time to install it. 410 // to install it.
400 void SetDelayedInstallInfo(const Extension* extension, 411 void SetDelayedInstallInfo(const Extension* extension,
401 Extension::State initial_state, 412 Extension::State initial_state,
413 DelayReason delay_reason,
402 const syncer::StringOrdinal& page_ordinal); 414 const syncer::StringOrdinal& page_ordinal);
403 415
404 // Removes any delayed install information we have for the given 416 // Removes any delayed install information we have for the given
405 // |extension_id|. Returns true if there was info to remove; false otherwise. 417 // |extension_id|. Returns true if there was info to remove; false otherwise.
406 bool RemoveDelayedInstallInfo(const std::string& extension_id); 418 bool RemoveDelayedInstallInfo(const std::string& extension_id);
407 419
408 // Update the prefs to finish the update for an extension. 420 // Update the prefs to finish the update for an extension.
409 bool FinishDelayedInstallInfo(const std::string& extension_id); 421 bool FinishDelayedInstallInfo(const std::string& extension_id);
410 422
411 // Returns the ExtensionInfo from the prefs for delayed install information 423 // Returns the ExtensionInfo from the prefs for delayed install information
412 // for |extension_id|, if we have any. Otherwise returns NULL. 424 // for |extension_id|, if we have any. Otherwise returns NULL.
413 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo( 425 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo(
414 const std::string& extension_id) const; 426 const std::string& extension_id) const;
415 427
428 DelayReason GetDelayedInstallReason(const std::string& extension_id) const;
429
416 // Returns information about all the extensions that have delayed install 430 // Returns information about all the extensions that have delayed install
417 // information. 431 // information.
418 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; 432 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
419 433
420 // Returns true if the user repositioned the app on the app launcher via drag 434 // Returns true if the user repositioned the app on the app launcher via drag
421 // and drop. 435 // and drop.
422 bool WasAppDraggedByUser(const std::string& extension_id); 436 bool WasAppDraggedByUser(const std::string& extension_id);
423 437
424 // Sets a flag indicating that the user repositioned the app on the app 438 // Sets a flag indicating that the user repositioned the app on the app
425 // launcher by drag and dropping it. 439 // launcher by drag and dropping it.
(...skipping 30 matching lines...) Expand all
456 // Returns true if there is an extension which controls the preference value 470 // Returns true if there is an extension which controls the preference value
457 // for |pref_key| *and* it is specific to incognito mode. 471 // for |pref_key| *and* it is specific to incognito mode.
458 bool HasIncognitoPrefValue(const std::string& pref_key); 472 bool HasIncognitoPrefValue(const std::string& pref_key);
459 473
460 // Clears incognito session-only content settings for all extensions. 474 // Clears incognito session-only content settings for all extensions.
461 void ClearIncognitoSessionOnlyContentSettings(); 475 void ClearIncognitoSessionOnlyContentSettings();
462 476
463 // Returns the creation flags mask for the extension. 477 // Returns the creation flags mask for the extension.
464 int GetCreationFlags(const std::string& extension_id) const; 478 int GetCreationFlags(const std::string& extension_id) const;
465 479
480 // Returns the creation flags mask for a delayed install extension.
481 int GetDelayedInstallCreationFlags(const std::string& extension_id) const;
482
466 // Returns true if the extension was installed from the Chrome Web Store. 483 // Returns true if the extension was installed from the Chrome Web Store.
467 bool IsFromWebStore(const std::string& extension_id) const; 484 bool IsFromWebStore(const std::string& extension_id) const;
468 485
469 // Returns true if the extension was installed from an App generated from a 486 // Returns true if the extension was installed from an App generated from a
470 // bookmark. 487 // bookmark.
471 bool IsFromBookmark(const std::string& extension_id) const; 488 bool IsFromBookmark(const std::string& extension_id) const;
472 489
473 // Returns true if the extension was installed as a default app. 490 // Returns true if the extension was installed as a default app.
474 bool WasInstalledByDefault(const std::string& extension_id) const; 491 bool WasInstalledByDefault(const std::string& extension_id) const;
475 492
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 scoped_ptr<TimeProvider> time_provider_; 662 scoped_ptr<TimeProvider> time_provider_;
646 663
647 bool extensions_disabled_; 664 bool extensions_disabled_;
648 665
649 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 666 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
650 }; 667 };
651 668
652 } // namespace extensions 669 } // namespace extensions
653 670
654 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 671 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698