summaryrefslogtreecommitdiff
path: root/chromium/components/about_handler
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-09 14:22:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-05-09 15:11:45 +0000
commit2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch)
treee75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/components/about_handler
parenta4f3d46271c57e8155ba912df46a05559d14726e (diff)
downloadqtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion. Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/components/about_handler')
-rw-r--r--chromium/components/about_handler/BUILD.gn17
-rw-r--r--chromium/components/about_handler/DEPS3
-rw-r--r--chromium/components/about_handler/OWNERS2
-rw-r--r--chromium/components/about_handler/about_protocol_handler.cc27
-rw-r--r--chromium/components/about_handler/about_protocol_handler.h30
-rw-r--r--chromium/components/about_handler/url_request_about_job.cc50
-rw-r--r--chromium/components/about_handler/url_request_about_job.h36
7 files changed, 165 insertions, 0 deletions
diff --git a/chromium/components/about_handler/BUILD.gn b/chromium/components/about_handler/BUILD.gn
new file mode 100644
index 00000000000..eeaff47f027
--- /dev/null
+++ b/chromium/components/about_handler/BUILD.gn
@@ -0,0 +1,17 @@
+# 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.
+
+source_set("about_handler") {
+ sources = [
+ "about_protocol_handler.cc",
+ "about_protocol_handler.h",
+ "url_request_about_job.cc",
+ "url_request_about_job.h",
+ ]
+
+ deps = [
+ "//base",
+ "//net",
+ ]
+}
diff --git a/chromium/components/about_handler/DEPS b/chromium/components/about_handler/DEPS
new file mode 100644
index 00000000000..8fa9d48d882
--- /dev/null
+++ b/chromium/components/about_handler/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+net",
+]
diff --git a/chromium/components/about_handler/OWNERS b/chromium/components/about_handler/OWNERS
new file mode 100644
index 00000000000..e48155ce8b4
--- /dev/null
+++ b/chromium/components/about_handler/OWNERS
@@ -0,0 +1,2 @@
+mmenke@chromium.org
+davidben@chromium.org
diff --git a/chromium/components/about_handler/about_protocol_handler.cc b/chromium/components/about_handler/about_protocol_handler.cc
new file mode 100644
index 00000000000..1f55f0407e8
--- /dev/null
+++ b/chromium/components/about_handler/about_protocol_handler.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 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/about_handler/about_protocol_handler.h"
+
+#include "components/about_handler/url_request_about_job.h"
+
+namespace about_handler {
+
+AboutProtocolHandler::AboutProtocolHandler() {
+}
+
+AboutProtocolHandler::~AboutProtocolHandler() {
+}
+
+net::URLRequestJob* AboutProtocolHandler::MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ return new URLRequestAboutJob(request, network_delegate);
+}
+
+bool AboutProtocolHandler::IsSafeRedirectTarget(const GURL& location) const {
+ return false;
+}
+
+} // namespace about_handler
diff --git a/chromium/components/about_handler/about_protocol_handler.h b/chromium/components/about_handler/about_protocol_handler.h
new file mode 100644
index 00000000000..eab2af03cb2
--- /dev/null
+++ b/chromium/components/about_handler/about_protocol_handler.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 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_ABOUT_HANDLER_ABOUT_PROTOCOL_HANDLER_H_
+#define COMPONENTS_ABOUT_HANDLER_ABOUT_PROTOCOL_HANDLER_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "net/url_request/url_request_job_factory.h"
+
+namespace about_handler {
+
+// Implements a ProtocolHandler for About jobs.
+class AboutProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
+ public:
+ AboutProtocolHandler();
+ ~AboutProtocolHandler() override;
+ net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const override;
+ bool IsSafeRedirectTarget(const GURL& location) const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AboutProtocolHandler);
+};
+
+} // namespace about_handler
+
+#endif // COMPONENTS_ABOUT_HANDLER_ABOUT_PROTOCOL_HANDLER_H_
diff --git a/chromium/components/about_handler/url_request_about_job.cc b/chromium/components/about_handler/url_request_about_job.cc
new file mode 100644
index 00000000000..71e7c1eafc5
--- /dev/null
+++ b/chromium/components/about_handler/url_request_about_job.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 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.
+
+// Simple implementation of about: protocol handler that treats everything as
+// about:blank. No other about: features should be available to web content,
+// so they're not implemented here.
+
+#include "components/about_handler/url_request_about_job.h"
+
+#include "base/bind.h"
+#include "base/compiler_specific.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
+
+namespace about_handler {
+
+URLRequestAboutJob::URLRequestAboutJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : URLRequestJob(request, network_delegate),
+ weak_factory_(this) {
+}
+
+void URLRequestAboutJob::Start() {
+ // Start reading asynchronously so that all error reporting and data
+ // callbacks happen as they would for network requests.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr()));
+}
+
+void URLRequestAboutJob::Kill() {
+ weak_factory_.InvalidateWeakPtrs();
+ URLRequestJob::Kill();
+}
+
+bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const {
+ *mime_type = "text/html";
+ return true;
+}
+
+URLRequestAboutJob::~URLRequestAboutJob() {
+}
+
+void URLRequestAboutJob::StartAsync() {
+ NotifyHeadersComplete();
+}
+
+} // namespace about_handler
diff --git a/chromium/components/about_handler/url_request_about_job.h b/chromium/components/about_handler/url_request_about_job.h
new file mode 100644
index 00000000000..d7a445d719b
--- /dev/null
+++ b/chromium/components/about_handler/url_request_about_job.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 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_ABOUT_HANDLER_URL_REQUEST_ABOUT_JOB_H_
+#define COMPONENTS_ABOUT_HANDLER_URL_REQUEST_ABOUT_JOB_H_
+
+#include <string>
+
+#include "base/memory/weak_ptr.h"
+#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_job.h"
+
+namespace about_handler {
+
+class URLRequestAboutJob : public net::URLRequestJob {
+ public:
+ URLRequestAboutJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
+
+ // URLRequestJob:
+ void Start() override;
+ void Kill() override;
+ bool GetMimeType(std::string* mime_type) const override;
+
+ private:
+ ~URLRequestAboutJob() override;
+
+ void StartAsync();
+
+ base::WeakPtrFactory<URLRequestAboutJob> weak_factory_;
+};
+
+} // namespace about_handler
+
+#endif // COMPONENTS_ABOUT_HANDLER_URL_REQUEST_ABOUT_JOB_H_