From 380de24f2ea0c8b708e5517ab8fc3c58362e4a92 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 22 Oct 2014 22:55:13 +0800 Subject: [PATCH] Add code to register tag --- atom.gyp | 5 + atom/browser/atom_browser_context.cc | 7 + atom/browser/atom_browser_context.h | 7 +- atom/browser/default_app/index.html | 2 + atom/browser/web_view/web_view_guest.cc | 11 + atom/browser/web_view/web_view_guest.h | 19 + atom/browser/web_view/web_view_manager.cc | 31 ++ atom/browser/web_view/web_view_manager.h | 35 ++ atom/renderer/lib/init.coffee | 2 + atom/renderer/lib/webview.coffee | 531 ++++++++++++++++++++++ 10 files changed, 649 insertions(+), 1 deletion(-) create mode 100644 atom/browser/web_view/web_view_guest.cc create mode 100644 atom/browser/web_view/web_view_guest.h create mode 100644 atom/browser/web_view/web_view_manager.cc create mode 100644 atom/browser/web_view/web_view_manager.h create mode 100644 atom/renderer/lib/webview.coffee diff --git a/atom.gyp b/atom.gyp index 7b439cbbfe1..0f69b18f41e 100644 --- a/atom.gyp +++ b/atom.gyp @@ -44,6 +44,7 @@ 'atom/renderer/lib/init.coffee', 'atom/renderer/lib/inspector.coffee', 'atom/renderer/lib/override.coffee', + 'atom/renderer/lib/webview.coffee', 'atom/renderer/api/lib/ipc.coffee', 'atom/renderer/api/lib/remote.coffee', 'atom/renderer/api/lib/web-view.coffee', @@ -178,6 +179,10 @@ 'atom/browser/ui/win/notify_icon.h', 'atom/browser/ui/x/x_window_utils.cc', 'atom/browser/ui/x/x_window_utils.h', + 'atom/browser/web_view/web_view_guest.cc', + 'atom/browser/web_view/web_view_guest.h', + 'atom/browser/web_view/web_view_manager.cc', + 'atom/browser/web_view/web_view_manager.h', 'atom/browser/window_list.cc', 'atom/browser/window_list.h', 'atom/browser/window_list_observer.h', diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index 4c4ac3d384c..ae3c6f70ae0 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -7,6 +7,7 @@ #include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/net/atom_url_request_job_factory.h" #include "atom/browser/net/asar/asar_protocol_handler.h" +#include "atom/browser/web_view/web_view_manager.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/worker_pool.h" #include "chrome/browser/browser_process.h" @@ -68,6 +69,12 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory( return top_job_factory.release(); } +content::BrowserPluginGuestManager* AtomBrowserContext::GetGuestManager() { + if (!guest_manager_) + guest_manager_.reset(new WebViewManager(this)); + return guest_manager_.get(); +} + // static AtomBrowserContext* AtomBrowserContext::Get() { return static_cast( diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index 95db71ff699..71a023cea5f 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -12,6 +12,7 @@ class BrowserProcess; namespace atom { class AtomURLRequestJobFactory; +class WebViewManager; class AtomBrowserContext : public brightray::BrowserContext { public: @@ -27,11 +28,15 @@ class AtomBrowserContext : public brightray::BrowserContext { // brightray::URLRequestContextGetter::Delegate: virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( content::ProtocolHandlerMap* handlers, - content::URLRequestInterceptorScopedVector* interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector* interceptors) override; + + // content::BrowserContext: + virtual content::BrowserPluginGuestManager* GetGuestManager() override; private: // A fake BrowserProcess object that used to feed the source code from chrome. scoped_ptr fake_browser_process_; + scoped_ptr guest_manager_; AtomURLRequestJobFactory* job_factory_; // Weak reference. diff --git a/atom/browser/default_app/index.html b/atom/browser/default_app/index.html index 83b5122782f..810f11f1847 100644 --- a/atom/browser/default_app/index.html +++ b/atom/browser/default_app/index.html @@ -56,6 +56,8 @@ + +