Commit 4fd82ccc authored by droger's avatar droger Committed by Commit bot

Move net-export resources to //components/net_log

This allows sharing the resources on iOS.

TBR=dbeam

Review URL: https://codereview.chromium.org/1361923005

Cr-Commit-Position: refs/heads/master@{#351067}
parent 7a9f2913
......@@ -193,8 +193,6 @@
<include name="IDR_INSTANT_CSS" file="resources\instant\instant.css" flattenhtml="true" type="BINDATA" />
<include name="IDR_INSTANT_HTML" file="resources\instant\instant.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_INSTANT_JS" file="resources\instant\instant.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_NET_EXPORT_HTML" file="resources\net_export\net_export.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_NET_EXPORT_JS" file="resources\net_export\net_export.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST" file="resources\network_speech_synthesis\manifest.json" type="BINDATA" />
<include name="IDR_PREDICTORS_HTML" file="resources\predictors\predictors.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_PREDICTORS_JS" file="resources\predictors\predictors.js" flattenhtml="true" type="BINDATA" />
......
......@@ -14,7 +14,9 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "components/grit/components_resources.h"
#include "components/net_log/chrome_net_log.h"
#include "components/net_log/net_export_ui_constants.h"
#include "components/net_log/net_log_temp_file.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_data_source.h"
......@@ -22,7 +24,6 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "grit/browser_resources.h"
#if defined(OS_ANDROID)
#include "chrome/browser/android/intent_helper.h"
......@@ -39,8 +40,8 @@ content::WebUIDataSource* CreateNetExportHTMLSource() {
content::WebUIDataSource::Create(chrome::kChromeUINetExportHost);
source->SetJsonPath("strings.js");
source->AddResourcePath("net_export.js", IDR_NET_EXPORT_JS);
source->SetDefaultResource(IDR_NET_EXPORT_HTML);
source->AddResourcePath(net_log::kNetExportUIJS, IDR_NET_LOG_NET_EXPORT_JS);
source->SetDefaultResource(IDR_NET_LOG_NET_EXPORT_HTML);
return source;
}
......@@ -112,19 +113,19 @@ void NetExportMessageHandler::RegisterMessages() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
web_ui()->RegisterMessageCallback(
"getExportNetLogInfo",
net_log::kGetExportNetLogInfoHandler,
base::Bind(&NetExportMessageHandler::OnGetExportNetLogInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"startNetLog",
net_log::kStartNetLogHandler,
base::Bind(&NetExportMessageHandler::OnStartNetLog,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"stopNetLog",
net_log::kStopNetLogHandler,
base::Bind(&NetExportMessageHandler::OnStopNetLog,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"sendNetLog",
net_log::kSendNetLogHandler,
base::Bind(&NetExportMessageHandler::OnSendNetLog,
base::Unretained(this)));
}
......@@ -241,8 +242,7 @@ void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) {
void NetExportMessageHandler::OnExportNetLogInfoChanged(base::Value* arg) {
scoped_ptr<base::Value> value(arg);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
web_ui()->CallJavascriptFunction(
"NetExportView.getInstance().onExportNetLogInfoChanged", *arg);
web_ui()->CallJavascriptFunction(net_log::kOnExportNetLogInfoChanged, *arg);
}
} // namespace
......
......@@ -21,6 +21,8 @@
# Note: sources list duplicated in GN build.
'net_log/chrome_net_log.cc',
'net_log/chrome_net_log.h',
'net_log/net_export_ui_constants.cc',
'net_log/net_export_ui_constants.h',
'net_log/net_log_temp_file.cc',
'net_log/net_log_temp_file.h',
],
......
......@@ -6,6 +6,8 @@ source_set("net_log") {
sources = [
"chrome_net_log.cc",
"chrome_net_log.h",
"net_export_ui_constants.cc",
"net_export_ui_constants.h",
"net_log_temp_file.cc",
"net_log_temp_file.h",
]
......
// Copyright 2015 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.
#include "components/net_log/net_export_ui_constants.h"
namespace net_log {
// Resource paths.
const char kNetExportUIJS[] = "net_export.js";
// Message handlers.
const char kGetExportNetLogInfoHandler[] = "getExportNetLogInfo";
const char kSendNetLogHandler[] = "sendNetLog";
const char kStartNetLogHandler[] = "startNetLog";
const char kStopNetLogHandler[] = "stopNetLog";
// Other values.
const char kOnExportNetLogInfoChanged[] =
"NetExportView.getInstance().onExportNetLogInfoChanged";
} // namespace net_log
// Copyright 2015 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.
#ifndef COMPONENTS_NET_LOG_NET_EXPORT_UI_CONSTANTS_H_
#define COMPONENTS_NET_LOG_NET_EXPORT_UI_CONSTANTS_H_
namespace net_log {
// Resource paths.
// Must match the resource file names.
extern const char kNetExportUIJS[];
// Message handlers.
// Must match the constants used in the resource files.
extern const char kGetExportNetLogInfoHandler[];
extern const char kSendNetLogHandler[];
extern const char kStartNetLogHandler[];
extern const char kStopNetLogHandler[];
// Other values.
// Must match the constants used in the resource files.
extern const char kOnExportNetLogInfoChanged[];
} // namespace net_log
#endif // COMPONENTS_NET_LOG_NET_EXPORT_UI_CONSTANTS_H_
......@@ -5,6 +5,13 @@
<if expr="is_android">
<meta name="viewport" content="width=device-width">
</if>
<if expr="is_ios">
<!-- TODO(jyquinn): Remove this once CRWWebUIPageBuilder can inject it.
See http://crbug.com/487000 -->
<script src="chrome://resources/js/ios/web_ui.js"></script>
</if>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://net-export/net_export.js"></script>
......
......@@ -12,6 +12,7 @@
<part file="dom_distiller_resources.grdp" />
<part file="flags_ui_resources.grdp" />
<part file="gcm_driver_resources.grdp" />
<part file="net_log_resources.grdp" />
<part file="printing_resources.grdp" />
<part file="proximity_auth_resources.grdp" />
<part file="security_interstitials_resources.grdp" />
......
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<include name="IDR_NET_LOG_NET_EXPORT_HTML" file="../net_log/resources/net_export.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_NET_LOG_NET_EXPORT_JS" file="../net_log/resources/net_export.js" flattenhtml="true" type="BINDATA" />
</grit-part>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment