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

Side by Side Diff: chrome/browser/resources/options/search_engine_manager.js

Issue 7003007: Apply content-security-policy to the HTML options page. This is a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel;
8
9 /**
10 * Encapsulated handling of search engine management page.
11 * @constructor
12 */
13 function SearchEngineManager() {
14 this.activeNavTab = null;
15 OptionsPage.call(this, 'searchEngines',
16 templateData.searchEngineManagerPageTabTitle,
17 'searchEngineManagerPage');
18 }
19
20 cr.addSingletonGetter(SearchEngineManager);
21
22 SearchEngineManager.prototype = {
23 __proto__: OptionsPage.prototype,
24
25 /**
26 * List for default search engine options
27 * @type {boolean}
28 * @private
29 */
30 defaultsList_: null,
31
32 /**
33 * List for other search engine options
34 * @type {boolean}
35 * @private
36 */
37 othersList_: null,
38
39 /** inheritDoc */
40 initializePage: function() {
41 OptionsPage.prototype.initializePage.call(this);
42
43 this.defaultsList_ = $('defaultSearchEngineList');
44 this.setUpList_(this.defaultsList_);
45
46 this.othersList_ = $('otherSearchEngineList');
47 this.setUpList_(this.othersList_);
48 },
49
50 /**
51 * Sets up the given list as a search engine list
52 * @param {List} list The list to set up.
53 * @private
54 */
55 setUpList_: function(list) {
56 options.search_engines.SearchEngineList.decorate(list);
57 list.autoExpands = true;
58 },
59
60 /**
61 * Updates the search engine list with the given entries.
62 * @private
63 * @param {Array} defaultEngines List of possible default search engines.
64 * @param {Array} otherEngines List of other search engines.
65 */
66 updateSearchEngineList_: function(defaultEngines, otherEngines) {
67 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines);
68 var othersModel = new ArrayDataModel(otherEngines);
69 // Add a "new engine" row.
70 othersModel.push({
71 'modelIndex': '-1'
72 });
73 this.othersList_.dataModel = othersModel;
74 },
75 };
76
77 SearchEngineManager.updateSearchEngineList = function(defaultEngines,
78 otherEngines) {
79 SearchEngineManager.getInstance().updateSearchEngineList_(defaultEngines,
80 otherEngines);
81 };
82
83 SearchEngineManager.validityCheckCallback = function(validity, modelIndex) {
84 // Forward to both lists; the one without a matching modelIndex will ignore
85 // it.
86 SearchEngineManager.getInstance().defaultsList_.validationComplete(
87 validity, modelIndex);
88 SearchEngineManager.getInstance().othersList_.validationComplete(
89 validity, modelIndex);
90 };
91
92 // Export
93 return {
94 SearchEngineManager: SearchEngineManager
95 };
96
97 });
98
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698