Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / components / InspectElementModeController.js
index 9175f6f..feb7a28 100644 (file)
 
 /**
  * @constructor
+ * @implements {WebInspector.TargetManager.Observer}
  */
 WebInspector.InspectElementModeController = function()
 {
     this._toggleSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
     this._shortcut = WebInspector.InspectElementModeController.createShortcut();
     InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EnterInspectElementMode, this._toggleSearch, this);
+    WebInspector.targetManager.observeTargets(this);
 }
 
 /**
@@ -46,6 +48,24 @@ WebInspector.InspectElementModeController.createShortcut = function()
 
 WebInspector.InspectElementModeController.prototype = {
     /**
+     * @param {!WebInspector.Target} target
+     */
+    targetAdded: function(target)
+    {
+        // When DevTools are opening in the inspect element mode, the first target comes in
+        // much later than the InspectorFrontendAPI.enterInspectElementMode event.
+        if (this.enabled())
+            target.domModel.setInspectModeEnabled(true, WebInspector.settings.showUAShadowDOM.get());
+    },
+
+    /**
+     * @param {!WebInspector.Target} target
+     */
+    targetRemoved: function(target)
+    {
+    },
+
+    /**
      * @return {boolean}
      */
     enabled: function()