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

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

Issue 196663003: Introduce an extension parameter which is used to customize the extension. It's available for exter… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed @finnur comments Created 6 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Sets the set of known disabled extension IDs. 173 // Sets the set of known disabled extension IDs.
174 void SetKnownDisabled(const ExtensionIdSet& extension_ids); 174 void SetKnownDisabled(const ExtensionIdSet& extension_ids);
175 175
176 // Called when an extension is installed, so that prefs get created. 176 // Called when an extension is installed, so that prefs get created.
177 // |blacklisted_for_malware| should be set if the extension was included in a 177 // |blacklisted_for_malware| should be set if the extension was included in a
178 // blacklist due to being malware. If |page_ordinal| is an invalid ordinal, 178 // blacklist due to being malware. If |page_ordinal| is an invalid ordinal,
179 // then a page will be found for the App. 179 // then a page will be found for the App.
180 void OnExtensionInstalled(const Extension* extension, 180 void OnExtensionInstalled(const Extension* extension,
181 Extension::State initial_state, 181 Extension::State initial_state,
182 bool blacklisted_for_malware, 182 bool blacklisted_for_malware,
183 const syncer::StringOrdinal& page_ordinal); 183 const syncer::StringOrdinal& page_ordinal,
184 const std::string& install_parameter);
184 185
185 // Called when an extension is uninstalled, so that prefs get cleaned up. 186 // Called when an extension is uninstalled, so that prefs get cleaned up.
186 void OnExtensionUninstalled(const std::string& extension_id, 187 void OnExtensionUninstalled(const std::string& extension_id,
187 const Manifest::Location& location, 188 const Manifest::Location& location,
188 bool external_uninstall); 189 bool external_uninstall);
189 190
190 // Called to change the extension's state when it is enabled/disabled. 191 // Called to change the extension's state when it is enabled/disabled.
191 void SetExtensionState(const std::string& extension_id, Extension::State); 192 void SetExtensionState(const std::string& extension_id, Extension::State);
192 193
193 // Called to change the extension's BlacklistState. Currently only used for 194 // Called to change the extension's BlacklistState. Currently only used for
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // extension is not present, NULL is returned. 411 // extension is not present, NULL is returned.
411 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( 412 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo(
412 const std::string& extension_id) const; 413 const std::string& extension_id) const;
413 414
414 // We've downloaded an updated .crx file for the extension, but are waiting 415 // We've downloaded an updated .crx file for the extension, but are waiting
415 // to install it. 416 // to install it.
416 void SetDelayedInstallInfo(const Extension* extension, 417 void SetDelayedInstallInfo(const Extension* extension,
417 Extension::State initial_state, 418 Extension::State initial_state,
418 bool blacklisted_for_malware, 419 bool blacklisted_for_malware,
419 DelayReason delay_reason, 420 DelayReason delay_reason,
420 const syncer::StringOrdinal& page_ordinal); 421 const syncer::StringOrdinal& page_ordinal,
422 const std::string& install_parameter);
421 423
422 // Removes any delayed install information we have for the given 424 // Removes any delayed install information we have for the given
423 // |extension_id|. Returns true if there was info to remove; false otherwise. 425 // |extension_id|. Returns true if there was info to remove; false otherwise.
424 bool RemoveDelayedInstallInfo(const std::string& extension_id); 426 bool RemoveDelayedInstallInfo(const std::string& extension_id);
425 427
426 // Update the prefs to finish the update for an extension. 428 // Update the prefs to finish the update for an extension.
427 bool FinishDelayedInstallInfo(const std::string& extension_id); 429 bool FinishDelayedInstallInfo(const std::string& extension_id);
428 430
429 // Returns the ExtensionInfo from the prefs for delayed install information 431 // Returns the ExtensionInfo from the prefs for delayed install information
430 // for |extension_id|, if we have any. Otherwise returns NULL. 432 // for |extension_id|, if we have any. Otherwise returns NULL.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // found. 472 // found.
471 base::Time GetInstallTime(const std::string& extension_id) const; 473 base::Time GetInstallTime(const std::string& extension_id) const;
472 474
473 // Gets/sets the last launch time of an extension. 475 // Gets/sets the last launch time of an extension.
474 base::Time GetLastLaunchTime(const std::string& extension_id) const; 476 base::Time GetLastLaunchTime(const std::string& extension_id) const;
475 void SetLastLaunchTime(const std::string& extension_id, 477 void SetLastLaunchTime(const std::string& extension_id,
476 const base::Time& time); 478 const base::Time& time);
477 479
478 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 480 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
479 481
480 bool extensions_disabled() { return extensions_disabled_; } 482 bool extensions_disabled() const { return extensions_disabled_; }
481 483
482 ContentSettingsStore* content_settings_store() { 484 ContentSettingsStore* content_settings_store() {
483 return content_settings_store_.get(); 485 return content_settings_store_.get();
484 } 486 }
485 487
486 // The underlying PrefService. 488 // The underlying PrefService.
487 PrefService* pref_service() const { return prefs_; } 489 PrefService* pref_service() const { return prefs_; }
488 490
489 // The underlying AppSorting. 491 // The underlying AppSorting.
490 AppSorting* app_sorting() const { return app_sorting_.get(); } 492 AppSorting* app_sorting() const { return app_sorting_.get(); }
(...skipping 13 matching lines...) Expand all
504 const base::DictionaryValue* GetGeometryCache( 506 const base::DictionaryValue* GetGeometryCache(
505 const std::string& extension_id) const; 507 const std::string& extension_id) const;
506 void SetGeometryCache(const std::string& extension_id, 508 void SetGeometryCache(const std::string& extension_id,
507 scoped_ptr<base::DictionaryValue> cache); 509 scoped_ptr<base::DictionaryValue> cache);
508 510
509 // Used for verification of installed extension ids. For the Set method, pass 511 // Used for verification of installed extension ids. For the Set method, pass
510 // null to remove the preference. 512 // null to remove the preference.
511 const base::DictionaryValue* GetInstallSignature(); 513 const base::DictionaryValue* GetInstallSignature();
512 void SetInstallSignature(const base::DictionaryValue* signature); 514 void SetInstallSignature(const base::DictionaryValue* signature);
513 515
516 // The installation parameter associated with the extension.
517 std::string GetInstallParam(const std::string& extension_id) const;
518 void SetInstallParam(const std::string& extension_id,
519 const std::string& install_parameter);
520
514 private: 521 private:
515 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. 522 friend class ExtensionPrefsBlacklistedExtensions; // Unit test.
516 friend class ExtensionPrefsUninstallExtension; // Unit test. 523 friend class ExtensionPrefsUninstallExtension; // Unit test.
517 524
518 // See the Create methods. 525 // See the Create methods.
519 ExtensionPrefs(PrefService* prefs, 526 ExtensionPrefs(PrefService* prefs,
520 const base::FilePath& root_dir, 527 const base::FilePath& root_dir,
521 ExtensionPrefValueMap* extension_pref_value_map, 528 ExtensionPrefValueMap* extension_pref_value_map,
522 scoped_ptr<AppSorting> app_sorting, 529 scoped_ptr<AppSorting> app_sorting,
523 scoped_ptr<TimeProvider> time_provider, 530 scoped_ptr<TimeProvider> time_provider,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 const ExtensionIdContainer& strings); 611 const ExtensionIdContainer& strings);
605 612
606 // Helper function to populate |extension_dict| with the values needed 613 // Helper function to populate |extension_dict| with the values needed
607 // by a newly installed extension. Work is broken up between this 614 // by a newly installed extension. Work is broken up between this
608 // function and FinishExtensionInfoPrefs() to accomodate delayed 615 // function and FinishExtensionInfoPrefs() to accomodate delayed
609 // installations. 616 // installations.
610 void PopulateExtensionInfoPrefs(const Extension* extension, 617 void PopulateExtensionInfoPrefs(const Extension* extension,
611 const base::Time install_time, 618 const base::Time install_time,
612 Extension::State initial_state, 619 Extension::State initial_state,
613 bool blacklisted_for_malware, 620 bool blacklisted_for_malware,
621 const std::string& install_parameter,
614 base::DictionaryValue* extension_dict); 622 base::DictionaryValue* extension_dict);
615 623
616 // Helper function to complete initialization of the values in 624 // Helper function to complete initialization of the values in
617 // |extension_dict| for an extension install. Also see 625 // |extension_dict| for an extension install. Also see
618 // PopulateExtensionInfoPrefs(). 626 // PopulateExtensionInfoPrefs().
619 void FinishExtensionInfoPrefs( 627 void FinishExtensionInfoPrefs(
620 const std::string& extension_id, 628 const std::string& extension_id,
621 const base::Time install_time, 629 const base::Time install_time,
622 bool needs_sort_ordinal, 630 bool needs_sort_ordinal,
623 const syncer::StringOrdinal& suggested_page_ordinal, 631 const syncer::StringOrdinal& suggested_page_ordinal,
(...skipping 18 matching lines...) Expand all
642 scoped_ptr<TimeProvider> time_provider_; 650 scoped_ptr<TimeProvider> time_provider_;
643 651
644 bool extensions_disabled_; 652 bool extensions_disabled_;
645 653
646 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 654 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
647 }; 655 };
648 656
649 } // namespace extensions 657 } // namespace extensions
650 658
651 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ 659 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698