summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 19:23:16 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 19:23:16 +0000
commitfa2e32bada9bb65f8aa595569d2f41c02715bc63 (patch)
tree92d20f80bf4876a3ac16908bcdc87853fd7a7059 /chrome/browser/debugger
parenta946f334c5b243f7792e1f338d8cf1ca9413b24a (diff)
downloadchromium_src-fa2e32bada9bb65f8aa595569d2f41c02715bc63.zip
chromium_src-fa2e32bada9bb65f8aa595569d2f41c02715bc63.tar.gz
chromium_src-fa2e32bada9bb65f8aa595569d2f41c02715bc63.tar.bz2
Rename DebuggerContents to DebuggerUI and move to the dom_ui folder.
Review URL: http://codereview.chromium.org/46036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r--chrome/browser/debugger/debugger.scons3
-rw-r--r--chrome/browser/debugger/debugger.vcproj8
-rw-r--r--chrome/browser/debugger/debugger_contents.cc150
-rw-r--r--chrome/browser/debugger/debugger_contents.h36
4 files changed, 0 insertions, 197 deletions
diff --git a/chrome/browser/debugger/debugger.scons b/chrome/browser/debugger/debugger.scons
index c1800f6..3b0cb2f 100644
--- a/chrome/browser/debugger/debugger.scons
+++ b/chrome/browser/debugger/debugger.scons
@@ -36,8 +36,6 @@ input_files = ChromeFileList([
'resources/debugger.js',
'resources/debugger_shell.js',
]),
- 'debugger_contents.cc',
- 'debugger_contents.h',
'debugger_host.h',
'debugger_host_impl.cpp',
'debugger_host_impl.h',
@@ -64,7 +62,6 @@ input_files = ChromeFileList([
if env.Bit('linux'):
# TODO(port): Port these.
input_files.Remove(
- 'debugger_contents.cc',
'debugger_view.cc',
'debugger_window.cc',
'dev_tools_view.cc',
diff --git a/chrome/browser/debugger/debugger.vcproj b/chrome/browser/debugger/debugger.vcproj
index 88af468..3cd3e16 100644
--- a/chrome/browser/debugger/debugger.vcproj
+++ b/chrome/browser/debugger/debugger.vcproj
@@ -142,14 +142,6 @@
</File>
</Filter>
<File
- RelativePath=".\debugger_contents.cc"
- >
- </File>
- <File
- RelativePath=".\debugger_contents.h"
- >
- </File>
- <File
RelativePath=".\debugger_host.h"
>
</File>
diff --git a/chrome/browser/debugger/debugger_contents.cc b/chrome/browser/debugger/debugger_contents.cc
deleted file mode 100644
index 5927caa..0000000
--- a/chrome/browser/debugger/debugger_contents.cc
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file defines utility functions for working with strings.
-
-#include "base/command_line.h"
-#include "base/file_util.h"
-#include "base/string_util.h"
-#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/debugger/debugger_contents.h"
-#include "chrome/browser/debugger/debugger_shell.h"
-#include "chrome/browser/debugger/debugger_wrapper.h"
-#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/resource_bundle.h"
-#include "net/base/mime_util.h"
-
-#include "grit/debugger_resources.h"
-
-// DebuggerUI is accessible from chrome-ui://inspector.
-static const char kDebuggerHost[] = "inspector";
-
-class DebuggerHTMLSource : public ChromeURLDataManager::DataSource {
- public:
- // Creates our datasource and sets our user message to a specific message
- // from our string bundle.
- DebuggerHTMLSource()
- : DataSource("debugger", MessageLoop::current()) { }
-
- // Called when the network layer has requested a resource underneath
- // the path we registered.
- virtual void StartDataRequest(const std::string& path, int request_id) {
- int resource_id = 0;
-
- if (!path.length()) {
- resource_id = IDR_DEBUGGER_HTML;
- } else if (path == "debugger.js") {
- resource_id = IDR_DEBUGGER_JS;
- } else if (path == "debugger.css") {
- resource_id = IDR_DEBUGGER_CSS;
- } else {
- SendResponse(request_id, NULL);
- return;
- }
-
- std::wstring debugger_path =
- CommandLine::ForCurrentProcess()->GetSwitchValue(
- switches::kJavaScriptDebuggerPath);
- std::string data_str;
- if (!debugger_path.empty() && file_util::PathExists(debugger_path)) {
- if (path.empty())
- file_util::AppendToPath(&debugger_path, L"debugger.html");
- else
- file_util::AppendToPath(&debugger_path, UTF8ToWide(path));
- if (!file_util::ReadFileToString(debugger_path, &data_str)) {
- SendResponse(request_id, NULL);
- return;
- }
- } else {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- data_str = rb.GetDataResource(resource_id);
- }
- scoped_refptr<RefCountedBytes> data_bytes(new RefCountedBytes);
- data_bytes->data.resize(data_str.size());
- std::copy(data_str.begin(), data_str.end(), data_bytes->data.begin());
-
- SendResponse(request_id, data_bytes);
- }
-
- virtual std::string GetMimeType(const std::string& path) const {
- // Currently but three choices {"", "debugger.js", "debugger.css"}.
- // Map the extension to mime-type, defaulting to "text/html".
- std::string mime_type("text/html");
-#if defined(OS_WIN)
- FilePath file_path(ASCIIToWide(path));
-#elif defined(OS_POSIX)
- FilePath file_path(path);
-#endif
- net::GetMimeTypeFromFile(file_path, &mime_type);
- return mime_type;
- }
-
- private:
- DISALLOW_EVIL_CONSTRUCTORS(DebuggerHTMLSource);
-};
-
-
-class DebuggerHandler : public DOMMessageHandler {
- public:
- explicit DebuggerHandler(DOMUI* dom_ui) : DOMMessageHandler(dom_ui) {
- dom_ui->RegisterMessageCallback("DebuggerHostMessage",
- NewCallback(this, &DebuggerHandler::HandleDebuggerHostMessage));
- }
-
- void HandleDebuggerHostMessage(const Value* content) {
- if (!content || !content->IsType(Value::TYPE_LIST)) {
- NOTREACHED();
- return;
- }
- const ListValue* args = static_cast<const ListValue*>(content);
- if (args->GetSize() < 1) {
- NOTREACHED();
- return;
- }
-
-#ifndef CHROME_DEBUGGER_DISABLED
- DebuggerWrapper* wrapper = g_browser_process->debugger_wrapper();
- DebuggerHost* debugger_host = wrapper->GetDebugger();
- if (!debugger_host) {
- NOTREACHED();
- return;
- }
- debugger_host->OnDebuggerHostMsg(args);
-#endif
- }
-
- private:
- DISALLOW_EVIL_CONSTRUCTORS(DebuggerHandler);
-};
-
-
-DebuggerContents::DebuggerContents(DOMUIContents* contents)
- : DOMUI(contents) {
-}
-
-void DebuggerContents::Init() {
- AddMessageHandler(new DebuggerHandler(this));
-
- DebuggerHTMLSource* html_source = new DebuggerHTMLSource();
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- html_source));
-}
-
-// static
-bool DebuggerContents::IsDebuggerUrl(const GURL& url) {
- return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) &&
- url.host() == kDebuggerHost);
-}
-
-// static
-GURL DebuggerContents::GetBaseURL() {
- std::string url = DOMUIContents::GetScheme();
- url += "://";
- url += kDebuggerHost;
- return GURL(url);
-}
diff --git a/chrome/browser/debugger/debugger_contents.h b/chrome/browser/debugger/debugger_contents.h
deleted file mode 100644
index 01689c3..0000000
--- a/chrome/browser/debugger/debugger_contents.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file defines utility functions for working with strings.
-
-#ifndef CHROME_BROWSER_SHELL_DEBUGGER_CONTENTS_H__
-#define CHROME_BROWSER_SHELL_DEBUGGER_CONTENTS_H__
-
-#include "chrome/browser/dom_ui/dom_ui.h"
-
-class DebuggerContents : public DOMUI {
- public:
- DebuggerContents(DOMUIContents* contents);
-
- // DOMUI Implementation
- virtual void Init();
-
- // Return the URL for the front page of this UI.
- static GURL GetBaseURL();
-
- static bool IsDebuggerUrl(const GURL& url);
-
- protected:
- DOMUIContents* contents_;
-
- // WebContents overrides:
- // We override updating history with a no-op so these pages
- // are not saved to history.
- virtual void UpdateHistoryForNavigation(const GURL& url,
- const ViewHostMsg_FrameNavigate_Params& params) { }
-
- DISALLOW_EVIL_CONSTRUCTORS(DebuggerContents);
-};
-
-#endif // CHROME_BROWSER_DEBUGGER_CONTENTS_H__