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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // version directory and the location. Blacklisted extensions won't be saved | 388 // version directory and the location. Blacklisted extensions won't be saved |
389 // and neither will external extensions the user has explicitly uninstalled. | 389 // and neither will external extensions the user has explicitly uninstalled. |
390 // Caller takes ownership of returned structure. | 390 // Caller takes ownership of returned structure. |
391 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; | 391 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; |
392 | 392 |
393 // Returns the ExtensionInfo from the prefs for the given extension. If the | 393 // Returns the ExtensionInfo from the prefs for the given extension. If the |
394 // extension is not present, NULL is returned. | 394 // extension is not present, NULL is returned. |
395 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 395 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
396 const std::string& extension_id) const; | 396 const std::string& extension_id) const; |
397 | 397 |
| 398 enum DelayReason { |
| 399 DELAY_REASON_NONE = 0, |
| 400 DELAY_REASON_GLOBAL = 1, |
| 401 DELAY_REASON_WAIT_FOR_IDLE = 2, |
| 402 DELAY_REASON_WAIT_FOR_IMPORTS = 3, |
| 403 }; |
| 404 |
398 // We've downloaded an updated .crx file for the extension, but are waiting | 405 // We've downloaded an updated .crx file for the extension, but are waiting |
399 // for idle time to install it. | 406 // to install it. |
400 void SetDelayedInstallInfo(const Extension* extension, | 407 void SetDelayedInstallInfo(const Extension* extension, |
401 Extension::State initial_state, | 408 Extension::State initial_state, |
| 409 DelayReason delay_reason, |
402 const syncer::StringOrdinal& page_ordinal); | 410 const syncer::StringOrdinal& page_ordinal); |
403 | 411 |
404 // Removes any delayed install information we have for the given | 412 // Removes any delayed install information we have for the given |
405 // |extension_id|. Returns true if there was info to remove; false otherwise. | 413 // |extension_id|. Returns true if there was info to remove; false otherwise. |
406 bool RemoveDelayedInstallInfo(const std::string& extension_id); | 414 bool RemoveDelayedInstallInfo(const std::string& extension_id); |
407 | 415 |
408 // Update the prefs to finish the update for an extension. | 416 // Update the prefs to finish the update for an extension. |
409 bool FinishDelayedInstallInfo(const std::string& extension_id); | 417 bool FinishDelayedInstallInfo(const std::string& extension_id); |
410 | 418 |
411 // Returns the ExtensionInfo from the prefs for delayed install information | 419 // Returns the ExtensionInfo from the prefs for delayed install information |
412 // for |extension_id|, if we have any. Otherwise returns NULL. | 420 // for |extension_id|, if we have any. Otherwise returns NULL. |
413 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo( | 421 scoped_ptr<ExtensionInfo> GetDelayedInstallInfo( |
414 const std::string& extension_id) const; | 422 const std::string& extension_id) const; |
415 | 423 |
| 424 DelayReason GetDelayedInstallReason(const std::string& extension_id) const; |
| 425 |
416 // Returns information about all the extensions that have delayed install | 426 // Returns information about all the extensions that have delayed install |
417 // information. | 427 // information. |
418 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; | 428 scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const; |
419 | 429 |
420 // Returns true if the user repositioned the app on the app launcher via drag | 430 // Returns true if the user repositioned the app on the app launcher via drag |
421 // and drop. | 431 // and drop. |
422 bool WasAppDraggedByUser(const std::string& extension_id); | 432 bool WasAppDraggedByUser(const std::string& extension_id); |
423 | 433 |
424 // Sets a flag indicating that the user repositioned the app on the app | 434 // Sets a flag indicating that the user repositioned the app on the app |
425 // launcher by drag and dropping it. | 435 // launcher by drag and dropping it. |
(...skipping 30 matching lines...) Expand all Loading... |
456 // Returns true if there is an extension which controls the preference value | 466 // Returns true if there is an extension which controls the preference value |
457 // for |pref_key| *and* it is specific to incognito mode. | 467 // for |pref_key| *and* it is specific to incognito mode. |
458 bool HasIncognitoPrefValue(const std::string& pref_key); | 468 bool HasIncognitoPrefValue(const std::string& pref_key); |
459 | 469 |
460 // Clears incognito session-only content settings for all extensions. | 470 // Clears incognito session-only content settings for all extensions. |
461 void ClearIncognitoSessionOnlyContentSettings(); | 471 void ClearIncognitoSessionOnlyContentSettings(); |
462 | 472 |
463 // Returns the creation flags mask for the extension. | 473 // Returns the creation flags mask for the extension. |
464 int GetCreationFlags(const std::string& extension_id) const; | 474 int GetCreationFlags(const std::string& extension_id) const; |
465 | 475 |
| 476 // Returns the creation flags mask for a delayed install extension. |
| 477 int GetDelayedInstallCreationFlags(const std::string& extension_id) const; |
| 478 |
466 // Returns true if the extension was installed from the Chrome Web Store. | 479 // Returns true if the extension was installed from the Chrome Web Store. |
467 bool IsFromWebStore(const std::string& extension_id) const; | 480 bool IsFromWebStore(const std::string& extension_id) const; |
468 | 481 |
469 // Returns true if the extension was installed from an App generated from a | 482 // Returns true if the extension was installed from an App generated from a |
470 // bookmark. | 483 // bookmark. |
471 bool IsFromBookmark(const std::string& extension_id) const; | 484 bool IsFromBookmark(const std::string& extension_id) const; |
472 | 485 |
473 // Returns true if the extension was installed as a default app. | 486 // Returns true if the extension was installed as a default app. |
474 bool WasInstalledByDefault(const std::string& extension_id) const; | 487 bool WasInstalledByDefault(const std::string& extension_id) const; |
475 | 488 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 scoped_ptr<TimeProvider> time_provider_; | 658 scoped_ptr<TimeProvider> time_provider_; |
646 | 659 |
647 bool extensions_disabled_; | 660 bool extensions_disabled_; |
648 | 661 |
649 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 662 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
650 }; | 663 }; |
651 | 664 |
652 } // namespace extensions | 665 } // namespace extensions |
653 | 666 |
654 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 667 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |