Bug 1321675 - Rename removeDevice to removeDeviceAssoc. r=gl draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 03 Feb 2017 17:23:49 -0600
changeset 480192 b5fb42c52a4ab11a02d22630b0ad0b8f2cb81e34
parent 480191 394827a8d15c1143592cef85ddb04004e776a382
child 480193 73cd3bc7025ad93770d29a4f0de0c59b7029d63e
push id44482
push userbmo:jryans@gmail.com
push dateTue, 07 Feb 2017 23:00:12 +0000
reviewersgl
bugs1321675
milestone54.0a1
Bug 1321675 - Rename removeDevice to removeDeviceAssoc. r=gl MozReview-Commit-ID: 1UMUfX23zUb
devtools/client/responsive.html/actions/index.js
devtools/client/responsive.html/actions/viewports.js
devtools/client/responsive.html/app.js
devtools/client/responsive.html/components/device-adder.js
devtools/client/responsive.html/components/resizable-viewport.js
devtools/client/responsive.html/components/viewport-dimension.js
devtools/client/responsive.html/components/viewport.js
devtools/client/responsive.html/components/viewports.js
devtools/client/responsive.html/manager.js
devtools/client/responsive.html/reducers/viewports.js
--- a/devtools/client/responsive.html/actions/index.js
+++ b/devtools/client/responsive.html/actions/index.js
@@ -49,17 +49,17 @@ createEnum([
 
   // Indicates that the device list loading action threw an error
   "LOAD_DEVICE_LIST_ERROR",
 
   // Indicates that the device list has been loaded successfully
   "LOAD_DEVICE_LIST_END",
 
   // Remove the viewport's device assocation.
-  "REMOVE_DEVICE",
+  "REMOVE_DEVICE_ASSOCIATION",
 
   // Resize the viewport.
   "RESIZE_VIEWPORT",
 
   // Rotate the viewport.
   "ROTATE_VIEWPORT",
 
   // Take a screenshot of the viewport.
--- a/devtools/client/responsive.html/actions/viewports.js
+++ b/devtools/client/responsive.html/actions/viewports.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {
   ADD_VIEWPORT,
   CHANGE_DEVICE,
   CHANGE_PIXEL_RATIO,
-  REMOVE_DEVICE,
+  REMOVE_DEVICE_ASSOCIATION,
   RESIZE_VIEWPORT,
   ROTATE_VIEWPORT
 } = require("./index");
 
 module.exports = {
 
   /**
    * Add an additional viewport to display the document.
@@ -45,19 +45,19 @@ module.exports = {
       id,
       pixelRatio,
     };
   },
 
   /**
    * Remove the viewport's device assocation.
    */
-  removeDevice(id) {
+  removeDeviceAssociation(id) {
     return {
-      type: REMOVE_DEVICE,
+      type: REMOVE_DEVICE_ASSOCIATION,
       id,
     };
   },
 
   /**
    * Resize the viewport.
    */
   resizeViewport(id, width, height) {
--- a/devtools/client/responsive.html/app.js
+++ b/devtools/client/responsive.html/app.js
@@ -16,17 +16,17 @@ const {
   updatePreferredDevices,
 } = require("./actions/devices");
 const { changeNetworkThrottling } = require("./actions/network-throttling");
 const { takeScreenshot } = require("./actions/screenshot");
 const { changeTouchSimulation } = require("./actions/touch-simulation");
 const {
   changeDevice,
   changePixelRatio,
-  removeDevice,
+  removeDeviceAssociation,
   resizeViewport,
   rotateViewport,
 } = require("./actions/viewports");
 const DeviceModal = createFactory(require("./components/device-modal"));
 const GlobalToolbar = createFactory(require("./components/global-toolbar"));
 const Viewports = createFactory(require("./components/viewports"));
 const Types = require("./types");
 
@@ -94,22 +94,22 @@ let App = createClass({
   onDeviceListUpdate(devices) {
     updatePreferredDevices(devices);
   },
 
   onExit() {
     window.postMessage({ type: "exit" }, "*");
   },
 
-  onRemoveDevice(id) {
+  onRemoveDeviceAssociation(id) {
     // TODO: Bug 1332754: Move messaging and logic into the action creator.
     window.postMessage({
-      type: "remove-device",
+      type: "remove-device-association",
     }, "*");
-    this.props.dispatch(removeDevice(id));
+    this.props.dispatch(removeDeviceAssociation(id));
     this.props.dispatch(changeTouchSimulation(false));
     this.props.dispatch(changePixelRatio(id, 0));
   },
 
   onResizeViewport(id, width, height) {
     this.props.dispatch(resizeViewport(id, width, height));
   },
 
@@ -144,17 +144,17 @@ let App = createClass({
       onBrowserMounted,
       onChangeDevice,
       onChangeNetworkThrottling,
       onChangePixelRatio,
       onChangeTouchSimulation,
       onContentResize,
       onDeviceListUpdate,
       onExit,
-      onRemoveDevice,
+      onRemoveDeviceAssociation,
       onResizeViewport,
       onRotateViewport,
       onScreenshot,
       onUpdateDeviceDisplayed,
       onUpdateDeviceModal,
     } = this;
 
     let selectedDevice = "";
@@ -191,17 +191,17 @@ let App = createClass({
       Viewports({
         devices,
         location,
         screenshot,
         viewports,
         onBrowserMounted,
         onChangeDevice,
         onContentResize,
-        onRemoveDevice,
+        onRemoveDeviceAssociation,
         onRotateViewport,
         onResizeViewport,
         onUpdateDeviceModal,
       }),
       DeviceModal({
         deviceAdderViewportTemplate,
         devices,
         onDeviceListUpdate,
--- a/devtools/client/responsive.html/components/device-adder.js
+++ b/devtools/client/responsive.html/components/device-adder.js
@@ -112,17 +112,17 @@ module.exports = createClass({
           },
           getStr("responsive.deviceAdderSize")
         ),
         ViewportDimension({
           viewport: {
             width: normalizedViewport.width,
             height: normalizedViewport.height,
           },
-          onRemoveDevice: () => {},
+          onRemoveDeviceAssociation: () => {},
           onResizeViewport: () => {},
         })
       ),
       dom.label(
         {},
         dom.span(
           {
             className: "device-adder-label"
--- a/devtools/client/responsive.html/components/resizable-viewport.js
+++ b/devtools/client/responsive.html/components/resizable-viewport.js
@@ -25,17 +25,17 @@ module.exports = createClass({
     devices: PropTypes.shape(Types.devices).isRequired,
     location: Types.location.isRequired,
     screenshot: PropTypes.shape(Types.screenshot).isRequired,
     swapAfterMount: PropTypes.bool.isRequired,
     viewport: PropTypes.shape(Types.viewport).isRequired,
     onBrowserMounted: PropTypes.func.isRequired,
     onChangeDevice: PropTypes.func.isRequired,
     onContentResize: PropTypes.func.isRequired,
-    onRemoveDevice: PropTypes.func.isRequired,
+    onRemoveDeviceAssociation: PropTypes.func.isRequired,
     onResizeViewport: PropTypes.func.isRequired,
     onRotateViewport: PropTypes.func.isRequired,
     onUpdateDeviceModal: PropTypes.func.isRequired,
   },
 
   getInitialState() {
     return {
       isResizing: false,
@@ -109,17 +109,17 @@ module.exports = createClass({
     this.props.onResizeViewport(width, height);
     // Change the device selector back to an unselected device
     // TODO: Bug 1332754: Logic like this probably belongs in the action creator.
     if (this.props.viewport.device) {
       // In bug 1329843 and others, we may eventually stop this approach of removing the
       // the properties of the device on resize.  However, at the moment, there is no
       // way to edit dPR when a device is selected, and there is no UI at all for editing
       // UA, so it's important to keep doing this for now.
-      this.props.onRemoveDevice();
+      this.props.onRemoveDeviceAssociation();
     }
 
     this.setState({
       lastClientX,
       lastClientY
     });
   },
 
--- a/devtools/client/responsive.html/components/viewport-dimension.js
+++ b/devtools/client/responsive.html/components/viewport-dimension.js
@@ -10,17 +10,17 @@ const { DOM: dom, createClass, PropTypes
 const Constants = require("../constants");
 const Types = require("../types");
 
 module.exports = createClass({
   displayName: "ViewportDimension",
 
   propTypes: {
     viewport: PropTypes.shape(Types.viewport).isRequired,
-    onRemoveDevice: PropTypes.func.isRequired,
+    onRemoveDeviceAssociation: PropTypes.func.isRequired,
     onResizeViewport: PropTypes.func.isRequired,
   },
 
   getInitialState() {
     let { width, height } = this.props.viewport;
 
     return {
       width,
@@ -111,17 +111,17 @@ module.exports = createClass({
       });
 
       return;
     }
 
     // Change the device selector back to an unselected device
     // TODO: Bug 1332754: Logic like this probably belongs in the action creator.
     if (this.props.viewport.device) {
-      this.props.onRemoveDevice();
+      this.props.onRemoveDeviceAssociation();
     }
     this.props.onResizeViewport(parseInt(this.state.width, 10),
                                 parseInt(this.state.height, 10));
   },
 
   render() {
     let editableClass = "viewport-dimension-editable";
     let inputClass = "viewport-dimension-input";
--- a/devtools/client/responsive.html/components/viewport.js
+++ b/devtools/client/responsive.html/components/viewport.js
@@ -19,38 +19,38 @@ module.exports = createClass({
     devices: PropTypes.shape(Types.devices).isRequired,
     location: Types.location.isRequired,
     screenshot: PropTypes.shape(Types.screenshot).isRequired,
     swapAfterMount: PropTypes.bool.isRequired,
     viewport: PropTypes.shape(Types.viewport).isRequired,
     onBrowserMounted: PropTypes.func.isRequired,
     onChangeDevice: PropTypes.func.isRequired,
     onContentResize: PropTypes.func.isRequired,
-    onRemoveDevice: PropTypes.func.isRequired,
+    onRemoveDeviceAssociation: PropTypes.func.isRequired,
     onResizeViewport: PropTypes.func.isRequired,
     onRotateViewport: PropTypes.func.isRequired,
     onUpdateDeviceModal: PropTypes.func.isRequired,
   },
 
   onChangeDevice(device, deviceType) {
     let {
       viewport,
       onChangeDevice,
     } = this.props;
 
     onChangeDevice(viewport.id, device, deviceType);
   },
 
-  onRemoveDevice() {
+  onRemoveDeviceAssociation() {
     let {
       viewport,
-      onRemoveDevice,
+      onRemoveDeviceAssociation,
     } = this.props;
 
-    onRemoveDevice(viewport.id);
+    onRemoveDeviceAssociation(viewport.id);
   },
 
   onResizeViewport(width, height) {
     let {
       viewport,
       onResizeViewport,
     } = this.props;
 
@@ -75,40 +75,40 @@ module.exports = createClass({
       viewport,
       onBrowserMounted,
       onContentResize,
       onUpdateDeviceModal,
     } = this.props;
 
     let {
       onChangeDevice,
-      onRemoveDevice,
+      onRemoveDeviceAssociation,
       onRotateViewport,
       onResizeViewport,
     } = this;
 
     return dom.div(
       {
         className: "viewport",
       },
       ViewportDimension({
         viewport,
-        onRemoveDevice,
+        onRemoveDeviceAssociation,
         onResizeViewport,
       }),
       ResizableViewport({
         devices,
         location,
         screenshot,
         swapAfterMount,
         viewport,
         onBrowserMounted,
         onChangeDevice,
         onContentResize,
-        onRemoveDevice,
+        onRemoveDeviceAssociation,
         onResizeViewport,
         onRotateViewport,
         onUpdateDeviceModal,
       })
     );
   },
 
 });
--- a/devtools/client/responsive.html/components/viewports.js
+++ b/devtools/client/responsive.html/components/viewports.js
@@ -17,32 +17,32 @@ module.exports = createClass({
   propTypes: {
     devices: PropTypes.shape(Types.devices).isRequired,
     location: Types.location.isRequired,
     screenshot: PropTypes.shape(Types.screenshot).isRequired,
     viewports: PropTypes.arrayOf(PropTypes.shape(Types.viewport)).isRequired,
     onBrowserMounted: PropTypes.func.isRequired,
     onChangeDevice: PropTypes.func.isRequired,
     onContentResize: PropTypes.func.isRequired,
-    onRemoveDevice: PropTypes.func.isRequired,
+    onRemoveDeviceAssociation: PropTypes.func.isRequired,
     onResizeViewport: PropTypes.func.isRequired,
     onRotateViewport: PropTypes.func.isRequired,
     onUpdateDeviceModal: PropTypes.func.isRequired,
   },
 
   render() {
     let {
       devices,
       location,
       screenshot,
       viewports,
       onBrowserMounted,
       onChangeDevice,
       onContentResize,
-      onRemoveDevice,
+      onRemoveDeviceAssociation,
       onResizeViewport,
       onRotateViewport,
       onUpdateDeviceModal,
     } = this.props;
 
     return dom.div(
       {
         id: "viewports",
@@ -53,17 +53,17 @@ module.exports = createClass({
           devices,
           location,
           screenshot,
           swapAfterMount: i == 0,
           viewport,
           onBrowserMounted,
           onChangeDevice,
           onContentResize,
-          onRemoveDevice,
+          onRemoveDeviceAssociation,
           onResizeViewport,
           onRotateViewport,
           onUpdateDeviceModal,
         });
       })
     );
   },
 
--- a/devtools/client/responsive.html/manager.js
+++ b/devtools/client/responsive.html/manager.js
@@ -462,18 +462,18 @@ ResponsiveUI.prototype = {
         this.onChangeTouchSimulation(event);
         break;
       case "content-resize":
         this.onContentResize(event);
         break;
       case "exit":
         this.onExit();
         break;
-      case "remove-device":
-        this.onRemoveDevice(event);
+      case "remove-device-association":
+        this.onRemoveDeviceAssociation(event);
         break;
     }
   },
 
   onChangeDevice: Task.async(function* (event) {
     let { userAgent, pixelRatio, touch } = event.data.device;
     yield this.updateUserAgent(userAgent);
     yield this.updateDPPX(pixelRatio);
@@ -507,17 +507,17 @@ ResponsiveUI.prototype = {
     });
   },
 
   onExit() {
     let { browserWindow, tab } = this;
     ResponsiveUIManager.closeIfNeeded(browserWindow, tab);
   },
 
-  onRemoveDevice: Task.async(function* (event) {
+  onRemoveDeviceAssociation: Task.async(function* (event) {
     yield this.updateUserAgent();
     yield this.updateDPPX();
     yield this.updateTouchSimulation();
     // Used by tests
     this.emit("device-removed");
   }),
 
   updateDPPX: Task.async(function* (dppx) {
--- a/devtools/client/responsive.html/reducers/viewports.js
+++ b/devtools/client/responsive.html/reducers/viewports.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {
   ADD_VIEWPORT,
   CHANGE_DEVICE,
   CHANGE_PIXEL_RATIO,
-  REMOVE_DEVICE,
+  REMOVE_DEVICE_ASSOCIATION,
   RESIZE_VIEWPORT,
   ROTATE_VIEWPORT,
 } = require("../actions/index");
 
 let nextViewportId = 0;
 
 const INITIAL_VIEWPORTS = [];
 const INITIAL_VIEWPORT = {
@@ -59,17 +59,17 @@ let reducers = {
       return Object.assign({}, viewport, {
         pixelRatio: {
           value: pixelRatio
         },
       });
     });
   },
 
-  [REMOVE_DEVICE](viewports, { id }) {
+  [REMOVE_DEVICE_ASSOCIATION](viewports, { id }) {
     return viewports.map(viewport => {
       if (viewport.id !== id) {
         return viewport;
       }
 
       return Object.assign({}, viewport, {
         device: "",
         deviceType: "",