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

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

Issue 10381097: Move content settings extension API to content_settings dir. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed conflict Created 8 years, 7 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
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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/extensions/extension_content_settings_store.h" 16 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h"
17 #include "chrome/browser/extensions/extension_prefs_scope.h" 17 #include "chrome/browser/extensions/extension_prefs_scope.h"
18 #include "chrome/browser/extensions/extension_scoped_prefs.h" 18 #include "chrome/browser/extensions/extension_scoped_prefs.h"
19 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
20 #include "chrome/common/string_ordinal.h" 20 #include "chrome/common/string_ordinal.h"
21 21
22 class ExtensionPrefValueMap; 22 class ExtensionPrefValueMap;
23 class ExtensionSorting; 23 class ExtensionSorting;
24 class PrefService; 24 class PrefService;
25 class URLPatternSet; 25 class URLPatternSet;
26 26
(...skipping 10 matching lines...) Expand all
37 // with an individual extension, such as lastUpdateTime. 37 // with an individual extension, such as lastUpdateTime.
38 // - per-extension preferences: 38 // - per-extension preferences:
39 // meta-preferences describing properties of the extension like 39 // meta-preferences describing properties of the extension like
40 // installation time, whether the extension is enabled, etc. 40 // installation time, whether the extension is enabled, etc.
41 // - extension controlled preferences: 41 // - extension controlled preferences:
42 // browser preferences that an extension controls. For example, an 42 // browser preferences that an extension controls. For example, an
43 // extension could use the proxy API to specify the browser's proxy 43 // extension could use the proxy API to specify the browser's proxy
44 // preference. Extension-controlled preferences are stored in 44 // preference. Extension-controlled preferences are stored in
45 // PrefValueStore::extension_prefs(), which this class populates and 45 // PrefValueStore::extension_prefs(), which this class populates and
46 // maintains as the underlying extensions change. 46 // maintains as the underlying extensions change.
47 class ExtensionPrefs : public ExtensionContentSettingsStore::Observer, 47 class ExtensionPrefs : public extensions::ContentSettingsStore::Observer,
48 public ExtensionScopedPrefs { 48 public ExtensionScopedPrefs {
49 public: 49 public:
50 // Key name for a preference that keeps track of per-extension settings. This 50 // Key name for a preference that keeps track of per-extension settings. This
51 // is a dictionary object read from the Preferences file, keyed off of 51 // is a dictionary object read from the Preferences file, keyed off of
52 // extension ids. 52 // extension ids.
53 static const char kExtensionsPref[]; 53 static const char kExtensionsPref[];
54 54
55 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; 55 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo;
56 56
57 // Vector containing identifiers for preferences. 57 // Vector containing identifiers for preferences.
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // bookmark. 397 // bookmark.
398 bool IsFromBookmark(const std::string& extension_id) const; 398 bool IsFromBookmark(const std::string& extension_id) const;
399 399
400 // Helper method to acquire the installation time of an extension. 400 // Helper method to acquire the installation time of an extension.
401 // Returns base::Time() if the installation time could not be parsed or 401 // Returns base::Time() if the installation time could not be parsed or
402 // found. 402 // found.
403 base::Time GetInstallTime(const std::string& extension_id) const; 403 base::Time GetInstallTime(const std::string& extension_id) const;
404 404
405 static void RegisterUserPrefs(PrefService* prefs); 405 static void RegisterUserPrefs(PrefService* prefs);
406 406
407 ExtensionContentSettingsStore* content_settings_store() { 407 extensions::ContentSettingsStore* content_settings_store() {
408 return content_settings_store_.get(); 408 return content_settings_store_.get();
409 } 409 }
410 410
411 // The underlying PrefService. 411 // The underlying PrefService.
412 PrefService* pref_service() const { return prefs_; } 412 PrefService* pref_service() const { return prefs_; }
413 413
414 // The underlying ExtensionSorting. 414 // The underlying ExtensionSorting.
415 ExtensionSorting* extension_sorting() const { 415 ExtensionSorting* extension_sorting() const {
416 return extension_sorting_.get(); 416 return extension_sorting_.get();
417 } 417 }
418 418
419 protected: 419 protected:
420 // For unit testing. Enables injecting an artificial clock that is used 420 // For unit testing. Enables injecting an artificial clock that is used
421 // to query the current time, when an extension is installed. 421 // to query the current time, when an extension is installed.
422 virtual base::Time GetCurrentTime() const; 422 virtual base::Time GetCurrentTime() const;
423 423
424 private: 424 private:
425 friend class ExtensionPrefsUninstallExtension; // Unit test. 425 friend class ExtensionPrefsUninstallExtension; // Unit test.
426 426
427 // ExtensionContentSettingsStore::Observer methods: 427 // extensions::ContentSettingsStore::Observer methods:
428 virtual void OnContentSettingChanged( 428 virtual void OnContentSettingChanged(
429 const std::string& extension_id, 429 const std::string& extension_id,
430 bool incognito) OVERRIDE; 430 bool incognito) OVERRIDE;
431 431
432 // ExtensionScopedPrefs methods: 432 // ExtensionScopedPrefs methods:
433 virtual void UpdateExtensionPref(const std::string& id, 433 virtual void UpdateExtensionPref(const std::string& id,
434 const std::string& key, 434 const std::string& key,
435 base::Value* value) OVERRIDE; 435 base::Value* value) OVERRIDE;
436 virtual void DeleteExtensionPrefs(const std::string& id) OVERRIDE; 436 virtual void DeleteExtensionPrefs(const std::string& id) OVERRIDE;
437 virtual bool ReadExtensionPrefBoolean( 437 virtual bool ReadExtensionPrefBoolean(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // Base extensions install directory. 530 // Base extensions install directory.
531 FilePath install_directory_; 531 FilePath install_directory_;
532 532
533 // Weak pointer, owned by Profile. 533 // Weak pointer, owned by Profile.
534 ExtensionPrefValueMap* extension_pref_value_map_; 534 ExtensionPrefValueMap* extension_pref_value_map_;
535 535
536 // Contains all the logic for handling the order for various extension 536 // Contains all the logic for handling the order for various extension
537 // properties. 537 // properties.
538 scoped_ptr<ExtensionSorting> extension_sorting_; 538 scoped_ptr<ExtensionSorting> extension_sorting_;
539 539
540 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; 540 scoped_refptr<extensions::ContentSettingsStore> content_settings_store_;
541 541
542 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 542 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
543 }; 543 };
544 544
545 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 545 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_registry.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698