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

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

Issue 2555373003: MD Settings: Deactivate the Camera when leaving the Change Picture page. (Closed)
Patch Set: fix closure compile Created 4 years 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.js
diff --git a/chrome/browser/resources/settings/people_page/change_picture.js b/chrome/browser/resources/settings/people_page/change_picture.js
index 0e18c64e516c01475fb0dd5339ca8ed8ac653738..977c4483b043ba79f1470673cefbb1cea35c43ae 100644
--- a/chrome/browser/resources/settings/people_page/change_picture.js
+++ b/chrome/browser/resources/settings/people_page/change_picture.js
@@ -35,6 +35,7 @@ Polymer({
is: 'settings-change-picture',
behaviors: [
+ settings.RouteObserverBehavior,
I18nBehavior,
WebUIListenerBehavior,
],
@@ -132,8 +133,18 @@ Polymer({
this.receiveProfileImage_.bind(this));
this.addWebUIListener('camera-presence-changed',
this.receiveCameraPresence_.bind(this));
+ },
+
- this.browserProxy_.initialize();
+ /** @protected */
+ currentRouteChanged: function(newRoute) {
+ // Reset the selection state when we navigate to this page.
+ if (newRoute == settings.Route.CHANGE_PICTURE) {
+ this.browserProxy_.initialize();
+ } else {
+ // Ensure we deactivate the camera when we navigate away.
+ this.selectedItem_ = null;
+ }
},
/**
@@ -374,7 +385,7 @@ Polymer({
* @private
*/
isCameraActive_: function(cameraPresent, selectedItem) {
- return cameraPresent && selectedItem &&
+ return cameraPresent && !!selectedItem &&
selectedItem.dataset.type == ChangePictureSelectionTypes.CAMERA;
},
@@ -394,7 +405,7 @@ Polymer({
* @private
*/
isAuthorCreditShown_: function(selectedItem) {
- return selectedItem &&
+ return !!selectedItem &&
selectedItem.dataset.type == ChangePictureSelectionTypes.DEFAULT;
},

Powered by Google App Engine
This is Rietveld 408576698