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

Unified Diff: chrome/browser/resources/settings/people_page/change_picture_private_api.js

Issue 1575543003: Settings People Revamp: Implement parts of ChromeOS Change Picture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor Created 4 years, 11 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/settings/people_page/change_picture_private_api.js
diff --git a/chrome/browser/resources/settings/people_page/change_picture_private_api.js b/chrome/browser/resources/settings/people_page/change_picture_private_api.js
new file mode 100644
index 0000000000000000000000000000000000000000..fa90ee0d5d65c291d27a72f85006f0a8e47616f7
--- /dev/null
+++ b/chrome/browser/resources/settings/people_page/change_picture_private_api.js
@@ -0,0 +1,69 @@
+// Copyright 2015 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.exportPath('settings');
+
+/**
+ * An object describing a default image.
+ * @typedef {{
+ * author: string,
+ * title: string,
+ * url: string,
+ * website: string
+ * }}
+ */
+settings.DefaultImage;
+
+cr.define('settings', function() {
+ /**
+ * API which encapsulates messaging between JS and C++ for the ChromeOS
+ * Change Picture subpage.
+ * @constructor
+ */
+ function ChangePicturePrivateApi() {}
+
+ /**
+ * URLs of special button images.
+ * @enum {string}
+ */
+ ChangePicturePrivateApi.ButtonImages = {
+ TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO',
+ CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE',
+ PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING'
+ };
+
+ /**
+ * Called from JavaScript. Retrieves the initial set of default images,
+ * profile image, etc.
dpapad 2016/01/13 19:00:07 It would be useful to mention in the comment which
tommycli 2016/01/13 19:35:17 Done.
+ */
+ ChangePicturePrivateApi.initialize = function() {
+ chrome.send('onChangePicturePageInitialized');
+ };
+
+ /**
+ * Called from JavaScript. Sets the user image to one of the default images.
+ * @param {string} imageUrl
+ */
+ ChangePicturePrivateApi.selectDefaultImage = function(imageUrl) {
+ chrome.send('selectImage', [imageUrl, 'default']);
+ };
+
+ /**
+ * Called from JavaScript. Sets the user image to the 'old' image.
+ */
+ ChangePicturePrivateApi.selectOldImage = function() {
+ chrome.send('selectImage', ['', 'old']);
+ };
+
+ /**
+ * Called from JavaScript. Sets the user image to the profile image.
+ */
+ ChangePicturePrivateApi.selectProfileImage = function() {
+ chrome.send('selectImage', ['', 'profile']);
+ };
+
+ return {
+ ChangePicturePrivateApi: ChangePicturePrivateApi,
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698