use generated constants
authordeepak1556 <hop2deep@gmail.com>
Thu, 21 May 2015 05:37:25 +0000 (11:07 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 21 May 2015 05:37:25 +0000 (11:07 +0530)
atom/browser/atom_browser_context.cc
atom/renderer/atom_render_view_observer.cc

index d340013..e31ebc4 100644 (file)
@@ -72,6 +72,13 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory(
   job_factory->SetProtocolHandler(
       url::kWssScheme, new HttpProtocolHandler(url::kWssScheme));
 
+  auto host_resolver = url_request_context_getter()
+                          ->GetURLRequestContext()
+                          ->host_resolver();
+  job_factory->SetProtocolHandler(
+      url::kFtpScheme, new net::FtpProtocolHandler(
+          new net::FtpNetworkLayer(host_resolver)));
+
   // Set up interceptors in the reverse order.
   scoped_ptr<net::URLRequestJobFactory> top_job_factory = job_factory.Pass();
   content::URLRequestInterceptorScopedVector::reverse_iterator it;
index 095a4fd..598af53 100644 (file)
@@ -17,6 +17,7 @@
 #include "content/public/renderer/render_view.h"
 #include "ipc/ipc_message_macros.h"
 #include "net/base/net_module.h"
+#include "net/grit/net_resources.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"
@@ -31,11 +32,6 @@ 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) {
@@ -57,10 +53,10 @@ std::vector<v8::Handle<v8::Value>> ListValueToVector(
 }
 
 base::StringPiece NetResourceProvider(int key) {
-  if (key == kIDR_DIR_HEADER_HTML) {
+  if (key == IDR_DIR_HEADER_HTML) {
     base::StringPiece html_data =
         ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
-            kIDR_DIR_HEADER_HTML);
+            IDR_DIR_HEADER_HTML);
     return html_data;
   }
   return base::StringPiece();