Upstream version 7.35.144.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / ProfileLauncherView.js
index 7f40ae5..084f730 100644 (file)
 
 /**
  * @constructor
- * @extends {WebInspector.View}
+ * @extends {WebInspector.VBox}
  * @param {!WebInspector.ProfilesPanel} profilesPanel
  */
 WebInspector.ProfileLauncherView = function(profilesPanel)
 {
-    WebInspector.View.call(this);
+    WebInspector.VBox.call(this);
 
     this._panel = profilesPanel;
 
@@ -47,6 +47,10 @@ WebInspector.ProfileLauncherView = function(profilesPanel)
 
     this._controlButton = this._contentElement.createChild("button", "control-profiling");
     this._controlButton.addEventListener("click", this._controlButtonClicked.bind(this), false);
+
+    this._loadButton = this._contentElement.createChild("button", "load-profile");
+    this._loadButton.textContent = WebInspector.UIString("Load");
+    this._loadButton.addEventListener("click", this._loadButtonClicked.bind(this), false);
 }
 
 WebInspector.ProfileLauncherView.prototype = {
@@ -70,6 +74,11 @@ WebInspector.ProfileLauncherView.prototype = {
         this._panel.toggleRecordButton();
     },
 
+    _loadButtonClicked: function()
+    {
+        this._panel.showLoadFromFileDialog();
+    },
+
     _updateControls: function()
     {
         if (this._isEnabled)
@@ -111,7 +120,7 @@ WebInspector.ProfileLauncherView.prototype = {
         this._updateControls();
     },
 
-    __proto__: WebInspector.View.prototype
+    __proto__: WebInspector.VBox.prototype
 }
 
 
@@ -152,6 +161,7 @@ WebInspector.MultiProfileLauncherView.prototype = {
         var optionElement = document.createElement("input");
         labelElement.insertBefore(optionElement, labelElement.firstChild);
         this._typeIdToOptionElement[profileType.id] = optionElement;
+        optionElement._profileType = profileType;
         optionElement.type = "radio";
         optionElement.name = "profile-type";
         optionElement.style.hidden = true;
@@ -165,13 +175,12 @@ WebInspector.MultiProfileLauncherView.prototype = {
 
     restoreSelectedProfileType: function()
     {
-        var typeName = WebInspector.settings.selectedProfileType.get();
-        if (!(typeName in this._typeIdToOptionElement))
-            typeName = Object.keys(this._typeIdToOptionElement)[0];
-        this._typeIdToOptionElement[typeName].checked = true;
-        this.dispatchEventToListeners(
-            WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected,
-            this._panel.getProfileType(typeName));
+        var typeId = WebInspector.settings.selectedProfileType.get();
+        if (!(typeId in this._typeIdToOptionElement))
+            typeId = Object.keys(this._typeIdToOptionElement)[0];
+        this._typeIdToOptionElement[typeId].checked = true;
+        var type = this._typeIdToOptionElement[typeId]._profileType;
+        this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected, type);
     },
 
     _controlButtonClicked: function()