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

Unified Diff: chrome/browser/resources/options/chromeos/change_picture_options.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/chromeos/change_picture_options.js
===================================================================
--- chrome/browser/resources/options/chromeos/change_picture_options.js (revision 84868)
+++ chrome/browser/resources/options/chromeos/change_picture_options.js (working copy)
@@ -1,121 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('options', function() {
-
- var OptionsPage = options.OptionsPage;
-
- /////////////////////////////////////////////////////////////////////////////
- // ChangePictureOptions class:
-
- /**
- * Encapsulated handling of ChromeOS change picture options page.
- * @constructor
- */
- function ChangePictureOptions() {
- OptionsPage.call(
- this,
- 'changePicture',
- localStrings.getString('changePicturePage'),
- 'change-picture-page');
- }
-
- cr.addSingletonGetter(ChangePictureOptions);
-
- ChangePictureOptions.prototype = {
- // Inherit ChangePictureOptions from OptionsPage.
- __proto__: options.OptionsPage.prototype,
-
- /**
- * Initializes ChangePictureOptions page.
- */
- initializePage: function() {
- // Call base class implementation to starts preference initialization.
- OptionsPage.prototype.initializePage.call(this);
-
- $('take-photo-button').addEventListener('click',
- this.handleTakePhoto_,
- false);
- $('choose-file-button').addEventListener('click',
- this.handleChooseFile_,
- false);
- chrome.send('getAvailableImages');
- },
-
- /**
- * Handler for when the user clicks on "Take photo" button.
- * @private
- * @param {Event} e Click Event.
- */
- handleTakePhoto_: function(e) {
- chrome.send('takePhoto');
- OptionsPage.navigateToPage('personal');
- },
-
- /**
- * Handler for when the user clicks on "Choose a file" button.
- * @private
- * @param {Event} e Click Event.
- */
- handleChooseFile_: function(e) {
- chrome.send('chooseFile');
- OptionsPage.navigateToPage('personal');
- },
-
- /**
- * Handler for when the user clicks on any available user image.
- * @private
- * @param {Event} e Click Event.
- */
- handleImageClick_: function(e) {
- chrome.send('selectImage', [e.target.src]);
- OptionsPage.navigateToPage('personal');
- },
-
- /**
- * Appends new image to the end of the image list.
- * @param {string} src A url for the user image.
- * @private
- */
- addUserImage_: function(src) {
- var imageElement = document.createElement('img');
- imageElement.src = src;
- imageElement.addEventListener('click',
- this.handleImageClick_,
- false);
- var divElement = document.createElement('div');
- divElement.classList.add('list-element');
- divElement.appendChild(imageElement);
- $('images-list').appendChild(divElement);
- },
-
- /**
- * Inserts received images before "Choose file" button.
- * @param {List} images A list of urls to user images.
- * @private
- */
- addUserImages_: function(images) {
- for (var i = 0; i < images.length; i++) {
- var imageUrl = images[i];
- this.addUserImage_(imageUrl);
- }
- },
- };
-
- // Forward public APIs to private implementations.
- [
- 'addUserImages',
- ].forEach(function(name) {
- ChangePictureOptions[name] = function(value) {
- ChangePictureOptions.getInstance()[name + '_'](value);
- };
- });
-
- // Export
- return {
- ChangePictureOptions: ChangePictureOptions
- };
-
-});
-

Powered by Google App Engine
This is Rietveld 408576698