summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/resources/component_extension_resources.grd2
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.cc13
-rw-r--r--chrome/browser/ui/webui/devtools_ui.cc77
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_dll.gypi1
-rw-r--r--chrome/common/chrome_switches.cc20
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/test/unit/chrome_test_suite.cc5
-rw-r--r--chrome/tools/build/win/FILES1
-rw-r--r--chrome/tools/build/win/FILES.cfg5
11 files changed, 108 insertions, 19 deletions
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd
index 0c90627..9449f1d 100644
--- a/chrome/browser/resources/component_extension_resources.grd
+++ b/chrome/browser/resources/component_extension_resources.grd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This comment is only here because changes to resources are not picked up
- without changes to the corresponding grd file. -->
+ without changes to the corresponding grd file. -->
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/component_extension_resources.h" type="rc_header">
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index abd7927..bf7f5e1 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
+#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/message_loop.h"
@@ -15,6 +16,7 @@
#include "chrome/browser/net/view_http_cache_job_factory.h"
#include "chrome/browser/ui/webui/shared_resources_data_source.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "content/browser/appcache/view_appcache_internals_job_factory.h"
#include "content/browser/browser_thread.h"
@@ -257,10 +259,13 @@ void ChromeURLDataManagerBackend::DataAvailable(RequestID request_id,
net::URLRequestJob* ChromeURLDataManagerBackend::Factory(
net::URLRequest* request,
const std::string& scheme) {
- // Try first with a file handler
- FilePath path;
- if (DevToolsJobFactory::IsSupportedURL(request->url(), &path))
- return DevToolsJobFactory::CreateJobForRequest(request, path);
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugDevTools)) {
+ // Try loading chrome-devtools:// files from disk.
+ FilePath path;
+ if (DevToolsJobFactory::IsSupportedURL(request->url(), &path))
+ return DevToolsJobFactory::CreateJobForRequest(request, path);
+ }
// Next check for chrome://view-http-cache/*, which uses its own job type.
if (ViewHttpCacheJobFactory::IsSupportedURL(request->url()))
diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc
index 5ed37d9..51daec8 100644
--- a/chrome/browser/ui/webui/devtools_ui.cc
+++ b/chrome/browser/ui/webui/devtools_ui.cc
@@ -4,10 +4,87 @@
#include "chrome/browser/ui/webui/devtools_ui.h"
+#include "base/string_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "grit/devtools_resources_map.h"
+#include "ui/base/resource/resource_bundle.h"
+
+namespace {
+
+std::string PathWithoutParams(const std::string& path) {
+ return GURL(std::string("chrome-devtools://devtools/") + path)
+ .path().substr(1);
+}
+
+}
+
+class DevToolsDataSource : public ChromeURLDataManager::DataSource {
+ public:
+ DevToolsDataSource();
+
+ virtual void StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id);
+ virtual std::string GetMimeType(const std::string& path) const;
+
+ private:
+ ~DevToolsDataSource() {}
+ DISALLOW_COPY_AND_ASSIGN(DevToolsDataSource);
+};
+
+
+DevToolsDataSource::DevToolsDataSource()
+ : DataSource(chrome::kChromeUIDevToolsHost, MessageLoop::current()) {
+}
+
+void DevToolsDataSource::StartDataRequest(const std::string& path,
+ bool is_off_the_record,
+ int request_id) {
+ std::string filename = PathWithoutParams(path);
+
+ int resource_id = -1;
+ for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) {
+ if (filename == kDevtoolsResources[i].name) {
+ resource_id = kDevtoolsResources[i].value;
+ break;
+ }
+ }
+
+ DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: "
+ << filename << ". If you compiled with debug_devtools=1, try running"
+ " with --debug-devtools.";
+ const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(
+ resource_id));
+ SendResponse(request_id, bytes);
+}
+
+std::string DevToolsDataSource::GetMimeType(const std::string& path) const {
+ std::string filename = PathWithoutParams(path);
+ if (EndsWith(filename, ".html", false)) {
+ return "text/html";
+ } else if (EndsWith(filename, ".css", false)) {
+ return "text/css";
+ } else if (EndsWith(filename, ".js", false)) {
+ return "application/javascript";
+ } else if (EndsWith(filename, ".png", false)) {
+ return "image/png";
+ } else if (EndsWith(filename, ".gif", false)) {
+ return "image/gif";
+ }
+ NOTREACHED();
+ return "text/plain";
+}
+
DevToolsUI::DevToolsUI(TabContents* contents) : WebUI(contents) {
+ DevToolsDataSource* data_source = new DevToolsDataSource();
+ contents->profile()->GetChromeURLDataManager()->AddDataSource(data_source);
}
void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 0471d6e..51611b3 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1325,6 +1325,7 @@
'variables': {
'pak_inputs': [
'<(grit_out_dir)/component_extension_resources.pak',
+ '<(grit_out_dir)/devtools_resources.pak',
'<(grit_out_dir)/net_internals_resources.pak',
'<(grit_out_dir)/shared_resources.pak',
'<(grit_out_dir)/sync_internals_resources.pak',
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index d8d319d..7f43add 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3270,6 +3270,7 @@
# These files are generated by GRIT.
'<(grit_out_dir)/grit/component_extension_resources_map.cc',
+ '<(grit_out_dir)/grit/devtools_resources_map.cc',
'<(grit_out_dir)/grit/shared_resources_map.cc',
'<(grit_out_dir)/grit/theme_resources_map.cc',
],
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index 24dca0d..c76a040 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -373,6 +373,7 @@
'variables': {
'pak_inputs': [
'<(grit_out_dir)/component_extension_resources.pak',
+ '<(grit_out_dir)/devtools_resources.pak',
'<(grit_out_dir)/net_internals_resources.pak',
'<(grit_out_dir)/shared_resources.pak',
'<(grit_out_dir)/sync_internals_resources.pak',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index f0a9056..000e96c 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -77,7 +77,7 @@ const char kAuthSchemes[] = "auth-schemes";
// Whitelist of servers which NTLM and Negotiate can automatically authenticate
// with using the default credentials of the currently logged in user.
-const char kAuthServerWhitelist[] = "auth-server-whitelist";
+const char kAuthServerWhitelist[] = "auth-server-whitelist";
// The value of this switch tells the app to listen for and broadcast
// automation-related messages on IPC channel with the given ID.
@@ -136,6 +136,10 @@ const char kConflictingModulesCheck[] = "conflicting-modules-check";
// string value, the 2 letter code from ISO 3166-1.
const char kCountry[] = "country";
+// If enabled, tries to load inspector files from disk (allows reloading of
+// devtool files without having to restart the browser).
+const char kDebugDevTools[] = "debug-devtools";
+
// Enables support to debug printing subsystem.
const char kDebugPrint[] = "debug-print";
@@ -240,10 +244,10 @@ const char kDisableHangMonitor[] = "disable-hang-monitor";
const char kDisableHistoryQuickProvider[] = "disable-history-quick-provider";
// Disable the use of the HistoryURLProvider for autocomplete results.
-const char kDisableHistoryURLProvider[] = "disable-history-url-provider";
+const char kDisableHistoryURLProvider[] = "disable-history-url-provider";
// Disable the Indexed Database API.
-const char kDisableIndexedDatabase[] = "disable-indexed-database";
+const char kDisableIndexedDatabase[] = "disable-indexed-database";
// Disables HTML5 Forms interactive validation.
const char kDisableInteractiveFormValidation[] =
@@ -390,7 +394,7 @@ extern const char kLogNetLog[] = "log-net-log";
const char kEnableAccelerated2dCanvas[] = "enable-accelerated-2d-canvas";
// Enables the hardware acceleration of plugins.
-const char kEnableAcceleratedPlugins[] = "enable-accelerated-plugins";
+const char kEnableAcceleratedPlugins[] = "enable-accelerated-plugins";
// Enables WebKit accessibility within the renderer process.
const char kEnableAccessibility[] = "enable-accessibility";
@@ -422,7 +426,7 @@ const char kEnableClientSidePhishingInterstitial[] =
const char kEnableClearServerData[] = "enable-clear-server-data";
// Enable click-to-play for blocked plug-ins.
-const char kEnableClickToPlay[] = "enable-click-to-play";
+const char kEnableClickToPlay[] = "enable-click-to-play";
// This applies only when the process type is "service". Enables the
// Cloud Print Proxy component within the service process.
@@ -627,7 +631,7 @@ const char kForceFieldTestNameAndValue[] = "force-fieldtest";
// Force renderer accessibility to be on instead of enabling it on demand when
// a screen reader is detected. The disable-renderer-accessibility switch
// overrides this if present.
-const char kForceRendererAccessibility[] = "force-renderer-accessibility";
+const char kForceRendererAccessibility[] = "force-renderer-accessibility";
// Specifies a custom name for the GSSAPI library to load.
const char kGSSAPILibraryName[] = "gssapi-library-name";
@@ -790,7 +794,7 @@ const char kNoStartupWindow[] = "no-startup-window";
// Show a desktop notification that the cloud print token has expired and
// that user needs to re-authenticate.
-const char kNotifyCloudPrintTokenExpired[] = "notify-cp-token-expired";
+const char kNotifyCloudPrintTokenExpired[] = "notify-cp-token-expired";
// Specifies the maximum number of threads to use for running the Proxy
// Autoconfig (PAC) script.
@@ -1001,7 +1005,7 @@ const char kSyncServiceURL[] = "sync-url";
const char kSyncTrySsltcpFirstForXmpp[] = "sync-try-ssltcp-first-for-xmpp";
// Use new experimental SyncerThread implementation and friends.
-const char kNewSyncerThread[] = "new-syncer-thread";
+const char kNewSyncerThread[] = "new-syncer-thread";
// Pass the name of the current running automated test to Chrome.
const char kTestName[] = "test-name";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index c494151..deb8ffb 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -53,6 +53,7 @@ extern const char kCloudPrintProxyId[];
extern const char kCloudPrintServiceURL[];
extern const char kConflictingModulesCheck[];
extern const char kCountry[];
+extern const char kDebugDevTools[];
extern const char kDebugPrint[];
extern const char kDeviceManagementUrl[];
extern const char kDevicePolicyCacheDir[];
diff --git a/chrome/test/unit/chrome_test_suite.cc b/chrome/test/unit/chrome_test_suite.cc
index 7fbc48b..f8eaf48 100644
--- a/chrome/test/unit/chrome_test_suite.cc
+++ b/chrome/test/unit/chrome_test_suite.cc
@@ -126,6 +126,11 @@ void ChromeTestSuite::Initialize() {
// Force unittests to run using en-US so if we test against string
// output, it'll pass regardless of the system language.
ResourceBundle::InitSharedInstance("en-US");
+ FilePath resources_pack_path;
+ PathService::Get(base::DIR_MODULE, &resources_pack_path);
+ resources_pack_path =
+ resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
+ ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
// initialize the global StatsTable for unit_tests (make sure the file
// doesn't exist before opening it so the test gets a clean slate)
diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES
index 73ce368..825aa6c 100644
--- a/chrome/tools/build/win/FILES
+++ b/chrome/tools/build/win/FILES
@@ -58,7 +58,6 @@ locales/uk.dll
locales/vi.dll
locales/zh-CN.dll
locales/zh-TW.dll
-resources
resources.pak
wow_helper.exe
gcswf32.dll
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index c3b9c2e..05739fc 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -311,11 +311,6 @@ FILES = [
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'resources',
- 'arch': ['32bit', '64bit'],
- 'buildtype': ['dev', 'official'],
- },
- {
'filename': 'resources.pak',
'arch': ['32bit', '64bit'],
'buildtype': ['dev', 'official'],