OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebKit / chromium / src / js / DevTools.js
index e3e0204..5bb150c 100644 (file)
  * DevTools frontend together. It is also responsible for overriding existing
  * WebInspector functionality while it is getting upstreamed into WebCore.
  */
-devtools.ToolsAgent = function()
-{
-    this.profilerAgent_ = new devtools.ProfilerAgent();
-};
-
-
-/**
- * @return {devtools.ProfilerAgent} Profiler agent instance.
- */
-devtools.ToolsAgent.prototype.getProfilerAgent = function()
-{
-    return this.profilerAgent_;
-};
-
-
-
-/**
- * Global instance of the tools agent.
- * @type {devtools.ToolsAgent}
- */
-devtools.tools = null;
-
 
 var context = {};  // Used by WebCore's inspector routines.
 
-///////////////////////////////////////////////////////////////////////////////
-// Here and below are overrides to existing WebInspector methods only.
-// TODO(pfeldman): Patch WebCore and upstream changes.
-var oldLoaded = WebInspector.loaded;
-WebInspector.loaded = function()
-{
-    devtools.tools = new devtools.ToolsAgent();
-
+(function () {
     Preferences.ignoreWhitespace = false;
     Preferences.samplingCPUProfiler = true;
     Preferences.heapProfilerPresent = true;
@@ -74,10 +45,13 @@ WebInspector.loaded = function()
     Preferences.profilerAlwaysEnabled = true;
     Preferences.canEditScriptSource = true;
     Preferences.onlineDetectionEnabled = false;
-    Preferences.domBreakpointsEnabled = true;
+    Preferences.nativeInstrumentationEnabled = true;
+    Preferences.fileSystemEnabled = false;
+    Preferences.showTimingTab = true;
+    Preferences.showCookiesTab = true;
+})();
 
-    oldLoaded.call(WebInspector);
-}
+var devtools = devtools || {};
 
 devtools.domContentLoaded = function()
 {
@@ -88,12 +62,12 @@ devtools.domContentLoaded = function()
 document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false);
 
 
+// FIXME: This needs to be upstreamed.
 (function InterceptProfilesPanelEvents()
 {
     var oldShow = WebInspector.ProfilesPanel.prototype.show;
     WebInspector.ProfilesPanel.prototype.show = function()
     {
-        devtools.tools.getProfilerAgent().initializeProfiling();
         this.enableToggleButton.visible = false;
         oldShow.call(this);
         // Show is called on every show event of a panel, so
@@ -191,7 +165,25 @@ WebInspector.resetToolbarColors = function()
 
 }
 
-// TODO(yurys): should be removed when eclipse debugger stops using it.
-if (window.RemoteDebuggerAgent) {
-    RemoteDebuggerAgent.setContextId = function() {};
+////////////////////////////////////////////////////////
+// Platform-specific WebInspector extensions support. //
+////////////////////////////////////////////////////////
+
+WebInspector.platformExtensionAPI = function(tabId)
+{
+    function getTabId()
+    {
+        return tabId;
+    }
+    webInspector.inspectedWindow.__proto__.__defineGetter__("tabId", getTabId);
+}
+
+WebInspector.buildPlatformExtensionAPI = function()
+{
+    return "(" + WebInspector.platformExtensionAPI + ")(" + WebInspector._inspectedTabId + ");";
+}
+
+WebInspector.setInspectedTabId = function(tabId)
+{
+    WebInspector._inspectedTabId = tabId;
 }