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

Side by Side Diff: chrome/browser/resources/settings/prefs/prefs_behavior.js

Issue 1372053002: Flesh out the location-page class to make it more general. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Common prefs behavior.
7 */
8
9 /** @polymerBehavior */
10 var PrefsBehavior = {
11 /**
12 * Gets the pref at the given prefPath. Throws if the pref is not found.
13 * @param {string} prefPath
14 * @return {!chrome.settingsPrivate.PrefObject}
15 * @protected
16 */
17 getPref: function(prefPath) {
18 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(
19 this.get(prefPath, this.prefs));
20 assert(typeof pref != 'undefined', 'Pref is missing: ' + prefPath);
21 return pref;
22 },
23
24 /**
25 * Sets the value of the pref at the given prefPath. Throws if the pref is not
26 * found.
27 * @param {string} prefPath
28 * @param {*} value
29 * @protected
30 */
31 setPrefValue: function(prefPath, value) {
32 this.getPref(prefPath); // Ensures we throw if the pref is not found.
33 this.set('prefs.' + prefPath + '.value', value);
34 },
35 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698