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

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

Issue 8060017: Ensure that --disable-extensions disables extension prefs from being enacted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split ExtensionPrefs constructor into constructor and Init function Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 LAUNCH_REGULAR, 60 LAUNCH_REGULAR,
61 LAUNCH_FULLSCREEN, 61 LAUNCH_FULLSCREEN,
62 LAUNCH_WINDOW, 62 LAUNCH_WINDOW,
63 63
64 // Launch an app in the in the way a click on the NTP would, 64 // Launch an app in the in the way a click on the NTP would,
65 // if no user pref were set. Update this constant to change 65 // if no user pref were set. Update this constant to change
66 // the default for the NTP and chrome.management.launchApp(). 66 // the default for the NTP and chrome.management.launchApp().
67 LAUNCH_DEFAULT = LAUNCH_REGULAR 67 LAUNCH_DEFAULT = LAUNCH_REGULAR
68 }; 68 };
69 69
70 // Does not assume ownership of |prefs| and |incognito_prefs|. 70 // Does not assume ownership of |prefs| and |extension_pref_value_map|.
71 // Note that you must call Init() to finalize construction.
71 ExtensionPrefs(PrefService* prefs, 72 ExtensionPrefs(PrefService* prefs,
72 const FilePath& root_dir, 73 const FilePath& root_dir,
73 ExtensionPrefValueMap* extension_pref_value_map); 74 ExtensionPrefValueMap* extension_pref_value_map);
74 virtual ~ExtensionPrefs(); 75 virtual ~ExtensionPrefs();
75 76
77 // If |extensions_disabled| is true, extension controlled preferences and
78 // content settings do not become effective.
79 void Init(bool extensions_disabled);
80
76 // Returns a copy of the Extensions prefs. 81 // Returns a copy of the Extensions prefs.
77 // TODO(erikkay) Remove this so that external consumers don't need to be 82 // TODO(erikkay) Remove this so that external consumers don't need to be
78 // aware of the internal structure of the preferences. 83 // aware of the internal structure of the preferences.
79 base::DictionaryValue* CopyCurrentExtensions(); 84 base::DictionaryValue* CopyCurrentExtensions();
80 85
81 // Returns true if the specified external extension was uninstalled by the 86 // Returns true if the specified external extension was uninstalled by the
82 // user. 87 // user.
83 bool IsExternalExtensionUninstalled(const std::string& id) const; 88 bool IsExternalExtensionUninstalled(const std::string& id) const;
84 89
85 // Checks whether |extension_id| is disabled. If there's no state pref for 90 // Checks whether |extension_id| is disabled. If there's no state pref for
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Checks if kPrefBlacklist is set to true in the DictionaryValue. 464 // Checks if kPrefBlacklist is set to true in the DictionaryValue.
460 // Return false if the value is false or kPrefBlacklist does not exist. 465 // Return false if the value is false or kPrefBlacklist does not exist.
461 // This is used to decide if an extension is blacklisted. 466 // This is used to decide if an extension is blacklisted.
462 static bool IsBlacklistBitSet(base::DictionaryValue* ext); 467 static bool IsBlacklistBitSet(base::DictionaryValue* ext);
463 468
464 // Fix missing preference entries in the extensions that are were introduced 469 // Fix missing preference entries in the extensions that are were introduced
465 // in a later Chrome version. 470 // in a later Chrome version.
466 void FixMissingPrefs(const ExtensionIdSet& extension_ids); 471 void FixMissingPrefs(const ExtensionIdSet& extension_ids);
467 472
468 // Installs the persistent extension preferences into |prefs_|'s extension 473 // Installs the persistent extension preferences into |prefs_|'s extension
469 // pref store. 474 // pref store. Does nothing if |extensions_disabled| is true.
470 void InitPrefStore(); 475 void InitPrefStore(bool extensions_disabled);
471 476
472 // Migrates the permissions data in the pref store. 477 // Migrates the permissions data in the pref store.
473 void MigratePermissions(const ExtensionIdSet& extension_ids); 478 void MigratePermissions(const ExtensionIdSet& extension_ids);
474 479
475 // Checks whether there is a state pref for the extension and if so, whether 480 // Checks whether there is a state pref for the extension and if so, whether
476 // it matches |check_state|. 481 // it matches |check_state|.
477 bool DoesExtensionHaveState(const std::string& id, 482 bool DoesExtensionHaveState(const std::string& id,
478 Extension::State check_state) const; 483 Extension::State check_state) const;
479 484
480 // The pref service specific to this set of extension prefs. Owned by profile. 485 // The pref service specific to this set of extension prefs. Owned by profile.
481 PrefService* prefs_; 486 PrefService* prefs_;
482 487
483 // Base extensions install directory. 488 // Base extensions install directory.
484 FilePath install_directory_; 489 FilePath install_directory_;
485 490
486 // Weak pointer, owned by Profile. 491 // Weak pointer, owned by Profile.
487 ExtensionPrefValueMap* extension_pref_value_map_; 492 ExtensionPrefValueMap* extension_pref_value_map_;
488 493
489 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; 494 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_;
490 495
491 // The URLs of all of the toolstrips. 496 // The URLs of all of the toolstrips.
492 URLList shelf_order_; 497 URLList shelf_order_;
493 498
494 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 499 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
495 }; 500 };
496 501
497 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 502 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698