OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 LAUNCH_REGULAR, | 74 LAUNCH_REGULAR, |
75 LAUNCH_FULLSCREEN, | 75 LAUNCH_FULLSCREEN, |
76 LAUNCH_WINDOW, | 76 LAUNCH_WINDOW, |
77 | 77 |
78 // Launch an app in the in the way a click on the NTP would, | 78 // Launch an app in the in the way a click on the NTP would, |
79 // if no user pref were set. Update this constant to change | 79 // if no user pref were set. Update this constant to change |
80 // the default for the NTP and chrome.management.launchApp(). | 80 // the default for the NTP and chrome.management.launchApp(). |
81 LAUNCH_DEFAULT = LAUNCH_REGULAR | 81 LAUNCH_DEFAULT = LAUNCH_REGULAR |
82 }; | 82 }; |
83 | 83 |
| 84 // This enum is used to store the reason an extension's install has been |
| 85 // delayed. Do not remove items or re-order this enum as it is used in |
| 86 // preferences. |
| 87 enum DelayReason { |
| 88 DELAY_REASON_NONE = 0, |
| 89 DELAY_REASON_GC = 1, |
| 90 DELAY_REASON_WAIT_FOR_IDLE = 2, |
| 91 DELAY_REASON_WAIT_FOR_IMPORTS = 3, |
| 92 }; |
| 93 |
| 94 |
84 // Creates base::Time classes. The default implementation is just to return | 95 // Creates base::Time classes. The default implementation is just to return |
85 // the current time, but tests can inject alternative implementations. | 96 // the current time, but tests can inject alternative implementations. |
86 class TimeProvider { | 97 class TimeProvider { |
87 public: | 98 public: |
88 TimeProvider(); | 99 TimeProvider(); |
89 | 100 |
90 virtual ~TimeProvider(); | 101 virtual ~TimeProvider(); |
91 | 102 |
92 // By default, returns the current time (base::Time::Now()). | 103 // By default, returns the current time (base::Time::Now()). |
93 virtual base::Time GetCurrentTime() const; | 104 virtual base::Time GetCurrentTime() const; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // and neither will external extensions the user has explicitly uninstalled. | 398 // and neither will external extensions the user has explicitly uninstalled. |
388 // Caller takes ownership of returned structure. | 399 // Caller takes ownership of returned structure. |
389 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; | 400 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; |
390 | 401 |
391 // Returns the ExtensionInfo from the prefs for the given extension. If the | 402 // Returns the ExtensionInfo from the prefs for the given extension. If the |
392 // extension is not present, NULL is returned. | 403 // extension is not present, NULL is returned. |
393 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 404 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
394 const std::string& extension_id) const; | 405 const std::string& extension_id) const; |
395 | 406 |
396 // We've downloaded an updated .crx file for the extension, but are waiting | 407 // We've downloaded an updated .crx file for the extension, but are waiting |
397 // for idle time to install it. | 408 // to install it. |
398 void SetDelayedInstallInfo(const Extension* extension, | 409 void SetDelayedInstallInfo(const Extension* extension, |
399 Extension::State initial_state, | 410 Extension::State initial_state, |
| 411 DelayReason delay_reason, |
400 const syncer::StringOrdinal& page_ordinal); | 412 const syncer::StringOrdinal& page_ordinal); |
401 | 413 |
402 // Removes any delayed install information we have for the given | 414 // Removes any delayed install information we have for the given |
403 // |extension_id|. Returns true if there was info to remove; false otherwise. | 415 // |extension_id|. Returns true if there was info to remove; false otherwise. |
404 bool RemoveDelayedInstallInfo(const std::string& extension_id); | 416 bool RemoveDelayedInstallInfo(const std::string& extension_id); |
405 | 417 |
406 // Update the prefs to finish the update for an extension. | 418 // Update the prefs to finish the update for an extension. |
407 bool FinishDelayedInstallInfo(const std::string& extension_id); | 419 bool FinishDelayedInstallInfo(const std::string& extension_id); |
408 | 420 |
409 // Returns the ExtensionInfo from the prefs for delayed install information | 421 // Returns the ExtensionInfo from the prefs for delayed install information |
410 // for |extension_id|, if we have any. Otherwise returns NULL. | 422 // for |extension_id|, if we have any. Otherwise returns NULL. |
411 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo( | 423 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo( |
412 const std::string& extension_id) const; | 424 const std::string& extension_id) const; |
413 | 425 |
| 426 DelayReason GetDelayedInstallReason(const std::string& extension_id) const; |
| 427 |
414 // Returns information about all the extensions that have delayed install | 428 // Returns information about all the extensions that have delayed install |
415 // information. | 429 // information. |
416 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; | 430 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; |
417 | 431 |
418 // Returns true if the user repositioned the app on the app launcher via drag | 432 // Returns true if the user repositioned the app on the app launcher via drag |
419 // and drop. | 433 // and drop. |
420 bool WasAppDraggedByUser(const std::string& extension_id); | 434 bool WasAppDraggedByUser(const std::string& extension_id); |
421 | 435 |
422 // Sets a flag indicating that the user repositioned the app on the app | 436 // Sets a flag indicating that the user repositioned the app on the app |
423 // launcher by drag and dropping it. | 437 // launcher by drag and dropping it. |
424 void SetAppDraggedByUser(const std::string& extension_id); | 438 void SetAppDraggedByUser(const std::string& extension_id); |
425 | 439 |
426 // Returns true if there is an extension which controls the preference value | 440 // Returns true if there is an extension which controls the preference value |
427 // for |pref_key| *and* it is specific to incognito mode. | 441 // for |pref_key| *and* it is specific to incognito mode. |
428 bool HasIncognitoPrefValue(const std::string& pref_key); | 442 bool HasIncognitoPrefValue(const std::string& pref_key); |
429 | 443 |
430 // Returns the creation flags mask for the extension. | 444 // Returns the creation flags mask for the extension. |
431 int GetCreationFlags(const std::string& extension_id) const; | 445 int GetCreationFlags(const std::string& extension_id) const; |
432 | 446 |
| 447 // Returns the creation flags mask for a delayed install extension. |
| 448 int GetDelayedInstallCreationFlags(const std::string& extension_id) const; |
| 449 |
433 // Returns true if the extension was installed from the Chrome Web Store. | 450 // Returns true if the extension was installed from the Chrome Web Store. |
434 bool IsFromWebStore(const std::string& extension_id) const; | 451 bool IsFromWebStore(const std::string& extension_id) const; |
435 | 452 |
436 // Returns true if the extension was installed from an App generated from a | 453 // Returns true if the extension was installed from an App generated from a |
437 // bookmark. | 454 // bookmark. |
438 bool IsFromBookmark(const std::string& extension_id) const; | 455 bool IsFromBookmark(const std::string& extension_id) const; |
439 | 456 |
440 // Returns true if the extension was installed as a default app. | 457 // Returns true if the extension was installed as a default app. |
441 bool WasInstalledByDefault(const std::string& extension_id) const; | 458 bool WasInstalledByDefault(const std::string& extension_id) const; |
442 | 459 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 scoped_ptr<TimeProvider> time_provider_; | 622 scoped_ptr<TimeProvider> time_provider_; |
606 | 623 |
607 bool extensions_disabled_; | 624 bool extensions_disabled_; |
608 | 625 |
609 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 626 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
610 }; | 627 }; |
611 | 628 |
612 } // namespace extensions | 629 } // namespace extensions |
613 | 630 |
614 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 631 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |