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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_settings_behavior.js

Issue 2156413002: Settings Router Refactor: Migrate to settings.Route.navigateTo calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge origin/master Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 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 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 /** 5 /**
6 * @fileoverview Behavior common to Site Settings classes. 6 * @fileoverview Behavior common to Site Settings classes.
7 */ 7 */
8 8
9 /** @polymerBehavior */ 9 /** @polymerBehavior */
10 var SiteSettingsBehaviorImpl = { 10 var SiteSettingsBehaviorImpl = {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS: 99 case settings.ContentSettingsTypes.PROTOCOL_HANDLERS:
100 return 'handlers'; 100 return 'handlers';
101 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS: 101 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS:
102 return 'unsandboxed-plugins'; 102 return 'unsandboxed-plugins';
103 default: 103 default:
104 return ''; 104 return '';
105 } 105 }
106 }, 106 },
107 107
108 /** 108 /**
109 * A utility function to lookup the route for a category name.
110 * @param {string} category The category ID to look up.
111 * @return {!settings.Route}
112 * @protected
113 */
114 computeCategoryRoute: function(category) {
115 switch (category) {
116 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS:
117 return settings.Route.SITE_SETTINGS_AUTOMATIC_DOWNLOADS;
118 case settings.ContentSettingsTypes.BACKGROUND_SYNC:
119 return settings.Route.SITE_SETTINGS_BACKGROUND_SYNC;
120 case settings.ContentSettingsTypes.CAMERA:
121 return settings.Route.SITE_SETTINGS_CAMERA;
122 case settings.ContentSettingsTypes.COOKIES:
123 return settings.Route.SITE_SETTINGS_COOKIES;
124 case settings.ContentSettingsTypes.GEOLOCATION:
125 return settings.Route.SITE_SETTINGS_LOCATION;
126 case settings.ContentSettingsTypes.IMAGES:
127 return settings.Route.SITE_SETTINGS_IMAGES;
128 case settings.ContentSettingsTypes.JAVASCRIPT:
129 return settings.Route.SITE_SETTINGS_JAVASCRIPT;
130 case settings.ContentSettingsTypes.KEYGEN:
131 return settings.Route.SITE_SETTINGS_KEYGEN;
132 case settings.ContentSettingsTypes.MIC:
133 return settings.Route.SITE_SETTINGS_MICROPHONE;
134 case settings.ContentSettingsTypes.NOTIFICATIONS:
135 return settings.Route.SITE_SETTINGS_NOTIFICATIONS;
136 case settings.ContentSettingsTypes.PLUGINS:
137 return settings.Route.SITE_SETTINGS_PLUGINS;
138 case settings.ContentSettingsTypes.POPUPS:
139 return settings.Route.SITE_SETTINGS_POPUPS;
140 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS:
141 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS;
142 default:
Dan Beam 2016/07/23 00:17:12 nit: if this list is exhaustive, can you remove th
tommycli 2016/07/25 16:47:21 Done.
143 assertNotReached();
144 }
145 },
146
147 /**
148 * A utility function to lookup the 'details' route for a category name.
149 * @param {string} category The category ID to look up.
150 * @return {!settings.Route}
151 * @protected
152 */
153 computeCategoryDetailsRoute: function(category) {
154 switch (category) {
155 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS:
156 return settings.Route.SITE_SETTINGS_AUTOMATIC_DOWNLOADS_DETAILS;
157 case settings.ContentSettingsTypes.BACKGROUND_SYNC:
158 return settings.Route.SITE_SETTINGS_BACKGROUND_SYNC_DETAILS;
159 case settings.ContentSettingsTypes.CAMERA:
160 return settings.Route.SITE_SETTINGS_CAMERA_DETAILS;
161 case settings.ContentSettingsTypes.COOKIES:
162 return settings.Route.SITE_SETTINGS_COOKIES_DETAILS;
163 case settings.ContentSettingsTypes.GEOLOCATION:
164 return settings.Route.SITE_SETTINGS_LOCATION_DETAILS;
165 case settings.ContentSettingsTypes.IMAGES:
166 return settings.Route.SITE_SETTINGS_IMAGES_DETAILS;
167 case settings.ContentSettingsTypes.JAVASCRIPT:
168 return settings.Route.SITE_SETTINGS_JAVASCRIPT_DETAILS;
169 case settings.ContentSettingsTypes.KEYGEN:
170 return settings.Route.SITE_SETTINGS_KEYGEN_DETAILS;
171 case settings.ContentSettingsTypes.MIC:
172 return settings.Route.SITE_SETTINGS_MICROPHONE_DETAILS;
173 case settings.ContentSettingsTypes.NOTIFICATIONS:
174 return settings.Route.SITE_SETTINGS_NOTIFICATIONS_DETAILS;
175 case settings.ContentSettingsTypes.PLUGINS:
176 return settings.Route.SITE_SETTINGS_PLUGINS_DETAILS;
177 case settings.ContentSettingsTypes.POPUPS:
178 return settings.Route.SITE_SETTINGS_POPUPS_DETAILS;
179 case settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS:
180 return settings.Route.SITE_SETTINGS_UNSANDBOXED_PLUGINS_DETAILS;
181 default:
182 assertNotReached();
Dan Beam 2016/07/23 00:17:12 same
tommycli 2016/07/25 16:47:21 Done.
183 }
184 },
185
186 /**
109 * A utility function to compute the icon to use for the category, both for 187 * A utility function to compute the icon to use for the category, both for
110 * the overall category as well as the individual permission in the details 188 * the overall category as well as the individual permission in the details
111 * for a site. 189 * for a site.
112 * @param {string} category The category to show the icon for. 190 * @param {string} category The category to show the icon for.
113 * @return {string} The id of the icon for the given category. 191 * @return {string} The id of the icon for the given category.
114 * @protected 192 * @protected
115 */ 193 */
116 computeIconForContentCategory: function(category) { 194 computeIconForContentCategory: function(category) {
117 switch (category) { 195 switch (category) {
118 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS: 196 case settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS:
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 * @private 459 * @private
382 */ 460 */
383 computeSiteIcon: function(site) { 461 computeSiteIcon: function(site) {
384 var url = this.ensureUrlHasScheme(site); 462 var url = this.ensureUrlHasScheme(site);
385 return 'background-image: ' + cr.icon.getFaviconImageSet(url); 463 return 'background-image: ' + cr.icon.getFaviconImageSet(url);
386 }, 464 },
387 }; 465 };
388 466
389 /** @polymerBehavior */ 467 /** @polymerBehavior */
390 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; 468 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698