protocol: adding ftp scheme support

This commit is contained in:
deepak1556 2015-05-14 20:32:40 +05:30
parent 71ee864d1d
commit ea147c588f
2 changed files with 22 additions and 0 deletions

View file

@ -16,8 +16,11 @@
#include "chrome/browser/browser_process.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_constants.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_context.h"
#include "url/url_constants.h"
using content::BrowserThread;

View file

@ -16,12 +16,14 @@
#include "base/strings/string_number_conversions.h"
#include "content/public/renderer/render_view.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/net_module.h"
#include "third_party/WebKit/public/web/WebDraggableRegion.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "ui/base/resource/resource_bundle.h"
#include "atom/common/node_includes.h"
@ -29,6 +31,11 @@ namespace atom {
namespace {
// A hack here:
// Copy from net/grit/net_resources.h of chromium repository
// since libchromiumcontent doesn't expose it.
const int kIDR_DIR_HEADER_HTML = 4000;
bool GetIPCObject(v8::Isolate* isolate,
v8::Handle<v8::Context> context,
v8::Handle<v8::Object>* ipc) {
@ -49,6 +56,16 @@ std::vector<v8::Handle<v8::Value>> ListValueToVector(
return result;
}
base::StringPiece NetResourceProvider(int key) {
if (key == kIDR_DIR_HEADER_HTML) {
base::StringPiece html_data =
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
kIDR_DIR_HEADER_HTML);
return html_data;
}
return base::StringPiece();
}
} // namespace
AtomRenderViewObserver::AtomRenderViewObserver(
@ -57,6 +74,8 @@ AtomRenderViewObserver::AtomRenderViewObserver(
: content::RenderViewObserver(render_view),
renderer_client_(renderer_client),
document_created_(false) {
// Initialise resource for directory listing.
net::NetModule::SetResourceProvider(NetResourceProvider);
}
AtomRenderViewObserver::~AtomRenderViewObserver() {