diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/dom_ui/net_internals_ui.cc | 78 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 37 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 7 | ||||
-rw-r--r-- | chrome/common/chrome_paths.cc | 15 | ||||
-rw-r--r-- | chrome/common/chrome_paths.h | 1 | ||||
-rw-r--r-- | chrome/installer/mini_installer/chrome.release | 2 | ||||
-rw-r--r-- | chrome/tools/build/win/FILES.cfg | 5 |
8 files changed, 69 insertions, 78 deletions
diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc index 553d197..96ee59e 100644 --- a/chrome/browser/dom_ui/net_internals_ui.cc +++ b/chrome/browser/dom_ui/net_internals_ui.cc @@ -36,6 +36,8 @@ #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/url_constants.h" #include "grit/generated_resources.h" +#include "grit/net_internals_resources.h" +#include "grit/net_internals_resources_map.h" #include "net/base/escape.h" #include "net/base/host_resolver_impl.h" #include "net/base/net_errors.h" @@ -316,51 +318,57 @@ NetInternalsHTMLSource::NetInternalsHTMLSource() void NetInternalsHTMLSource::StartDataRequest(const std::string& path, bool is_off_the_record, int request_id) { - // The provided |path| identifies a file in resources/net_internals/. - std::string data_string; - FilePath file_path; - PathService::Get(chrome::DIR_NET_INTERNALS, &file_path); - std::string filename; - // The provided "path" may contain a fragment, or query section. We only // care about the path itself, and will disregard anything else. - filename = GURL(std::string("chrome://net/") + path).path().substr(1); - + std::string filename = + GURL(std::string("chrome://net/") + path).path().substr(1); if (filename.empty()) filename = "index.html"; - file_path = file_path.AppendASCII(filename); - - if (!file_util::ReadFileToString(file_path, &data_string)) { - LOG(WARNING) << "Could not read resource: " << file_path.value(); - data_string = StringPrintf("<p style='color:red'>Failed to read file " - "RESOURCES/net_internals/%s</p>", - EscapeForHTML(filename).c_str()); - - // During the transition from old implementation to new implementation, - // users may be entering the URLs for the old frontend. - data_string.append( - "<p>Note that the URL scheme for net-internals has changed because of " - "its new implementation (bug 37421):</p>" - "<ul>" - "<li>chrome://net-internals/proxyservice.* → " - "<a href='chrome://net-internals#proxy'>chrome://net-internals#proxy" - "</a></li>" - "<li>chrome://net-internals/hostresolver.* → <a href='chrome://net" - "-internals#dns'>chrome://net-internals#dns</a></li>" - "<li>chrome://net-internals/urlrequest.* → <a href='chrome://net-" - "internals#requests'>chrome://net-internals#requests</a></li>" - "<li>chrome://net-internals/ (overview for copy-pasting) → <a href" - "='chrome://net-internals#data'>chrome://net-internals#data</a></li>" - "<li>chrome://net-internals/view-cache/* → <a href=" - "'chrome://view-http-cache'>chrome://view-http-cache</a></li>" - "</ul>"); + // The name of the files in the grd list are prefixed with the following + // directory: + std::string key("net_internals/"); + key += filename; + + const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + for (size_t i = 0; i < kNetInternalsResourcesSize; ++i) { + if (kNetInternalsResources[i].name == key) { + scoped_refptr<RefCountedStaticMemory> bytes( + rb.LoadDataResourceBytes(kNetInternalsResources[i].value)); + if (bytes && bytes->front()) { + SendResponse(request_id, bytes); + return; + } + } } + LOG(WARNING) << "Could not read resource: " << path; + std::string data_string = "<p style='color:red'>Failed to read resource"; + data_string.append(EscapeForHTML(filename)); + data_string.append("</p>"); + + // During the transition from old implementation to new implementation, + // users may be entering the URLs for the old frontend. + data_string.append( + "<p>Note that the URL scheme for net-internals has changed because of " + "its new implementation (bug 37421):</p>" + "<ul>" + "<li>chrome://net-internals/proxyservice.* → " + "<a href='chrome://net-internals#proxy'>chrome://net-internals#proxy" + "</a></li>" + "<li>chrome://net-internals/hostresolver.* → <a href='chrome://net" + "-internals#dns'>chrome://net-internals#dns</a></li>" + "<li>chrome://net-internals/urlrequest.* → <a href='chrome://net-" + "internals#requests'>chrome://net-internals#requests</a></li>" + "<li>chrome://net-internals/ (overview for copy-pasting) → <a href" + "='chrome://net-internals#data'>chrome://net-internals#data</a></li>" + "<li>chrome://net-internals/view-cache/* → <a href=" + "'chrome://view-http-cache'>chrome://view-http-cache</a></li>" + "</ul>"); + scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes); bytes->data.resize(data_string.size()); std::copy(data_string.begin(), data_string.end(), bytes->data.begin()); - SendResponse(request_id, bytes); } diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 6868b88..a486c7d 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -448,6 +448,8 @@ 'outputs': [ '<(grit_out_dir)/grit/<(RULE_INPUT_ROOT).h', '<(grit_out_dir)/<(RULE_INPUT_ROOT).pak', + '<(grit_out_dir)/grit/<(RULE_INPUT_ROOT)_map.cc', + '<(grit_out_dir)/grit/<(RULE_INPUT_ROOT)_map.h', # TODO(bradnelson): move to something like this instead #'<!@(<(grit_info_cmd) --outputs \'<(grit_out_dir)\' <(chrome_resources_grds))', # This currently cannot work because gyp only evaluates the diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0b99752..4e8f2b0 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -17,7 +17,6 @@ 'chrome_version_info', 'component_extensions', 'domui_shared_resources', - 'net_internals_resources', 'platform_locale_settings', 'profile_import', 'browser/sync/protocol/sync_proto.gyp:sync_proto_cpp', @@ -2688,8 +2687,9 @@ 'browser/zygote_host_linux.cc', 'browser/zygote_main_linux.cc', - # This file is generated by GRIT. + # These files are generated by GRIT. '<(grit_out_dir)/grit/theme_resources_map.cc', + '<(grit_out_dir)/grit/net_internals_resources_map.cc', ], 'conditions': [ ['javascript_engine=="v8"', { @@ -3558,39 +3558,6 @@ ], }, { - 'target_name': 'net_internals_resources', - 'type': 'none', - # TODO(eroman): Once the msvs port supports it, change this to recursively - # copy the entire directory instead of listing the files. - # http://code.google.com/p/gyp/issues/detail?id=143. - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)/resources/net_internals', - 'files': [ - 'browser/resources/net_internals/dataview.js', - 'browser/resources/net_internals/detailsview.js', - 'browser/resources/net_internals/dnsview.js', - 'browser/resources/net_internals/httpcacheview.js', - 'browser/resources/net_internals/index.html', - 'browser/resources/net_internals/loggrouper.js', - 'browser/resources/net_internals/logviewpainter.js', - 'browser/resources/net_internals/main.css', - 'browser/resources/net_internals/main.js', - 'browser/resources/net_internals/proxyview.js', - 'browser/resources/net_internals/requestsview.js', - 'browser/resources/net_internals/resizableverticalsplitview.js', - 'browser/resources/net_internals/sourceentry.js', - 'browser/resources/net_internals/tabswitcherview.js', - 'browser/resources/net_internals/testview.js', - 'browser/resources/net_internals/timelineviewpainter.js', - 'browser/resources/net_internals/topmidbottomview.js', - 'browser/resources/net_internals/util.js', - 'browser/resources/net_internals/view.js', - ] - }, - ] - }, - { # Protobuf compiler / generate rule for feedback 'target_name': 'userfeedback_proto', 'type': 'none', diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 71863b1e..eced91f 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -445,7 +445,6 @@ '<(PRODUCT_DIR)/resources/gmail_app/', '<(PRODUCT_DIR)/resources/calendar_app/', '<(PRODUCT_DIR)/resources/docs_app/', - '<(PRODUCT_DIR)/resources/net_internals/' ], 'conditions': [ ['mac_breakpad==1', { @@ -482,6 +481,12 @@ }], ], }, + { + 'destination': '<(PRODUCT_DIR)', + 'files': [ + '<(INTERMEDIATE_DIR)/repack/resources.pak' + ], + }, ], 'conditions': [ ['mac_breakpad==1', { diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 9dca7e0..738ee3a 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -168,11 +168,6 @@ bool PathProvider(int key, FilePath* result) { return false; cur = cur.Append(FILE_PATH_LITERAL("inspector")); break; - case chrome::DIR_NET_INTERNALS: - if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) - return false; - cur = cur.Append(FILE_PATH_LITERAL("net_internals")); - break; case chrome::DIR_APP_DICTIONARIES: #if defined(OS_LINUX) || defined(OS_MACOSX) // We can't write into the EXE dir on Linux, so keep dictionaries @@ -250,6 +245,16 @@ bool PathProvider(int key, FilePath* result) { #endif break; case chrome::FILE_RESOURCES_PACK: +#if defined(OS_MACOSX) + if (mac_util::AmIBundled()) { + cur = mac_util::MainAppBundlePath(); + cur = cur.Append(FILE_PATH_LITERAL("Resources")) + .Append(FILE_PATH_LITERAL("resources.pak")); + break; + } + // If we're not bundled on mac, resources.pak should be next to the + // binary (e.g., for unit tests). +#endif if (!PathService::Get(base::DIR_EXE, &cur)) return false; cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h index 69239ad..258123d 100644 --- a/chrome/common/chrome_paths.h +++ b/chrome/common/chrome_paths.h @@ -26,7 +26,6 @@ enum { // by DOMUI and component extensions. DIR_BOOKMARK_MANAGER, // Directory containing the bookmark manager. DIR_INSPECTOR, // Directory where web inspector is located. - DIR_NET_INTERNALS, // Directory where net internals is located. DIR_APP_DICTIONARIES, // Directory where the global dictionaries are. DIR_USER_DOCUMENTS, // Directory for a user's "My Documents". DIR_DEFAULT_DOWNLOADS_SAFE, // Directory for a user's diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release index 311b5deec..e1de42c 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -36,6 +36,7 @@ nacl64.exe: %(VersionDir)s\ nacl64.dll: %(VersionDir)s\ icudt42.dll: %(VersionDir)s\ gears.dll: %(VersionDir)s\ +resources.pak: %(VersionDir)s\ Themes\default.dll: %(VersionDir)s\Themes locales\*.dll: %(VersionDir)s\Locales Resources\bookmark_manager\*.*: %(VersionDir)s\Resources\bookmark_manager @@ -50,7 +51,6 @@ Resources\shared\js\cr\*.*: %(VersionDir)s\Resources\shared\js\cr Resources\shared\js\cr\ui\*.*: %(VersionDir)s\Resources\shared\js\cr\ui Resources\Inspector\*.*: %(VersionDir)s\Resources\Inspector Resources\Inspector\Images\*.*: %(VersionDir)s\Resources\Inspector\Images -Resources\net_internals\*.*: %(VersionDir)s\Resources\net_internals Resources\gmail_app\*.*: %(VersionDir)s\Resources\gmail_app Resources\calendar_app\*.*: %(VersionDir)s\Resources\calendar_app Resources\docs_app\*.*: %(VersionDir)s\Resources\docs_app diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg index 609596e..c258ca2 100644 --- a/chrome/tools/build/win/FILES.cfg +++ b/chrome/tools/build/win/FILES.cfg @@ -321,6 +321,11 @@ FILES = [ 'buildtype': ['dev', 'official'], }, { + 'filename': 'resources.pak', + 'arch': ['32bit', '64bit'], + 'buildtype': ['dev', 'official'], + }, + { 'filename': 'wow_helper.exe', 'arch': ['32bit', '64bit'], 'buildtype': ['dev', 'official'], |