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

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

Issue 11465016: Dedupe code in SetIdleInstallInfo(), FinishIdleInstallInfo() and OnExtensionInstalled(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest. Created 8 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 | 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_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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; 378 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const;
379 379
380 // Returns the ExtensionInfo from the prefs for the given extension. If the 380 // Returns the ExtensionInfo from the prefs for the given extension. If the
381 // extension is not present, NULL is returned. 381 // extension is not present, NULL is returned.
382 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( 382 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo(
383 const std::string& extension_id) const; 383 const std::string& extension_id) const;
384 384
385 // We've downloaded an updated .crx file for the extension, but are waiting 385 // We've downloaded an updated .crx file for the extension, but are waiting
386 // for idle time to install it. 386 // for idle time to install it.
387 void SetIdleInstallInfo(const Extension* extension, 387 void SetIdleInstallInfo(const Extension* extension,
388 Extension::State initial_state); 388 Extension::State initial_state,
389 const syncer::StringOrdinal& page_ordinal);
389 390
390 // Removes any idle install information we have for the given |extension_id|. 391 // Removes any idle install information we have for the given |extension_id|.
391 // Returns true if there was info to remove; false otherwise. 392 // Returns true if there was info to remove; false otherwise.
392 bool RemoveIdleInstallInfo(const std::string& extension_id); 393 bool RemoveIdleInstallInfo(const std::string& extension_id);
393 394
394 // Update the prefs to finish the update for an extension. 395 // Update the prefs to finish the update for an extension.
395 bool FinishIdleInstallInfo(const std::string& extension_id); 396 bool FinishIdleInstallInfo(const std::string& extension_id);
396 397
397 // Returns the ExtensionInfo from the prefs for idle install information for 398 // Returns the ExtensionInfo from the prefs for idle install information for
398 // |extension_id|, if we have any. Otherwise returns NULL. 399 // |extension_id|, if we have any. Otherwise returns NULL.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // Checks whether there is a state pref for the extension and if so, whether 601 // Checks whether there is a state pref for the extension and if so, whether
601 // it matches |check_state|. 602 // it matches |check_state|.
602 bool DoesExtensionHaveState(const std::string& id, 603 bool DoesExtensionHaveState(const std::string& id,
603 Extension::State check_state) const; 604 Extension::State check_state) const;
604 605
605 // Helper function to Get/Set array of strings from/to prefs. 606 // Helper function to Get/Set array of strings from/to prefs.
606 ExtensionIdList GetExtensionPrefAsVector(const char* pref); 607 ExtensionIdList GetExtensionPrefAsVector(const char* pref);
607 void SetExtensionPrefFromVector(const char* pref, 608 void SetExtensionPrefFromVector(const char* pref,
608 const ExtensionIdList& extension_ids); 609 const ExtensionIdList& extension_ids);
609 610
611 void PopulateExtensionInfoPrefs(const Extension* extension,
612 const base::Time install_time,
613 Extension::State initial_state,
614 DictionaryValue* extension_dict);
615
616 void FinishExtensionInfoPrefs(
617 const std::string& extension_id,
618 const base::Time install_time,
619 bool needs_sort_ordinal,
620 const syncer::StringOrdinal& suggested_page_ordinal,
621 DictionaryValue* extension_dict);
622
610 // The pref service specific to this set of extension prefs. Owned by profile. 623 // The pref service specific to this set of extension prefs. Owned by profile.
611 PrefService* prefs_; 624 PrefService* prefs_;
612 625
613 // Base extensions install directory. 626 // Base extensions install directory.
614 FilePath install_directory_; 627 FilePath install_directory_;
615 628
616 // Weak pointer, owned by Profile. 629 // Weak pointer, owned by Profile.
617 ExtensionPrefValueMap* extension_pref_value_map_; 630 ExtensionPrefValueMap* extension_pref_value_map_;
618 631
619 // Contains all the logic for handling the order for various extension 632 // Contains all the logic for handling the order for various extension
620 // properties. 633 // properties.
621 scoped_ptr<ExtensionSorting> extension_sorting_; 634 scoped_ptr<ExtensionSorting> extension_sorting_;
622 635
623 scoped_refptr<ContentSettingsStore> content_settings_store_; 636 scoped_refptr<ContentSettingsStore> content_settings_store_;
624 637
625 scoped_ptr<TimeProvider> time_provider_; 638 scoped_ptr<TimeProvider> time_provider_;
626 639
627 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 640 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
628 }; 641 };
629 642
630 } // namespace extensions 643 } // namespace extensions
631 644
632 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 645 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | chrome/browser/extensions/extension_prefs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698