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

Side by Side 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 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 cr.exportPath('settings');
6
7 /**
8 * An object describing a default image.
9 * @typedef {{
10 * author: string,
11 * title: string,
12 * url: string,
13 * website: string
14 * }}
15 */
16 settings.DefaultImage;
17
18 cr.define('settings', function() {
19 /**
20 * API which encapsulates messaging between JS and C++ for the ChromeOS
21 * Change Picture subpage.
22 * @constructor
23 */
24 function ChangePicturePrivateApi() {}
25
26 /**
27 * URLs of special button images.
28 * @enum {string}
29 */
30 ChangePicturePrivateApi.ButtonImages = {
31 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO',
32 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE',
33 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING'
34 };
35
36 /**
37 * Called from JavaScript. Retrieves the initial set of default images,
38 * 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.
39 */
40 ChangePicturePrivateApi.initialize = function() {
41 chrome.send('onChangePicturePageInitialized');
42 };
43
44 /**
45 * Called from JavaScript. Sets the user image to one of the default images.
46 * @param {string} imageUrl
47 */
48 ChangePicturePrivateApi.selectDefaultImage = function(imageUrl) {
49 chrome.send('selectImage', [imageUrl, 'default']);
50 };
51
52 /**
53 * Called from JavaScript. Sets the user image to the 'old' image.
54 */
55 ChangePicturePrivateApi.selectOldImage = function() {
56 chrome.send('selectImage', ['', 'old']);
57 };
58
59 /**
60 * Called from JavaScript. Sets the user image to the profile image.
61 */
62 ChangePicturePrivateApi.selectProfileImage = function() {
63 chrome.send('selectImage', ['', 'profile']);
64 };
65
66 return {
67 ChangePicturePrivateApi: ChangePicturePrivateApi,
68 };
69 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698