| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_H_ | |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_H_ | |
| 7 | |
| 8 #include "base/process.h" | |
| 9 #include "content/renderer/render_view_impl.h" | |
| 10 #include "ipc/ipc_channel_handle.h" | |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | |
| 13 #include "ui/gfx/size.h" | |
| 14 #include "webkit/plugins/webview_plugin.h" | |
| 15 | |
| 16 namespace WebKit { | |
| 17 class WebPlugin; | |
| 18 } | |
| 19 | |
| 20 namespace content { | |
| 21 | |
| 22 class RenderView; | |
| 23 | |
| 24 namespace old { | |
| 25 | |
| 26 // A browser plugin is a plugin container that hosts an out-of-process "guest" | |
| 27 // RenderView. Loading up a new process, creating a new RenderView, navigating | |
| 28 // to a given URL, and establishing a guest-to-embedder channel can take | |
| 29 // hundreds of milliseconds. Furthermore, a RenderView's associated browser-side | |
| 30 // WebContents, RenderViewHost, and SiteInstance must be created and accessed on | |
| 31 // the UI thread of the browser process. | |
| 32 // | |
| 33 // To avoid blocking the embedder RenderView and to avoid introducing the | |
| 34 // potential for deadlock, BrowserPlugin attaches a placeholder that takes | |
| 35 // place of the guest RenderView until the guest has established a connection | |
| 36 // with its embedder RenderView. This permits asynchronously loading of the | |
| 37 // guest while the embedder RenderView is permitted to continue to receive and | |
| 38 // process events. | |
| 39 // | |
| 40 // Furthermore, certain navigations can swap to a new guest RenderView on an | |
| 41 // different process. BrowserPlugin is the consistent facade that the embedder's | |
| 42 // WebKit instance talks to regardless of which process it's communicating with. | |
| 43 class BrowserPlugin { | |
| 44 public: | |
| 45 // Creates a new WebViewPlugin with a BrowserPlugin as a delegate. | |
| 46 static WebKit::WebPlugin* Create( | |
| 47 RenderViewImpl* render_view, | |
| 48 WebKit::WebFrame* frame, | |
| 49 const WebKit::WebPluginParams& params); | |
| 50 | |
| 51 static BrowserPlugin* FromID(int id); | |
| 52 | |
| 53 webkit::WebViewPlugin* placeholder() { return placeholder_; } | |
| 54 | |
| 55 webkit::ppapi::WebPluginImpl* plugin() { return plugin_; } | |
| 56 | |
| 57 const WebKit::WebPluginParams& plugin_params() const { | |
| 58 return plugin_params_; | |
| 59 } | |
| 60 | |
| 61 void LoadGuest(int guest_process_id, | |
| 62 const IPC::ChannelHandle& channel_handle); | |
| 63 | |
| 64 void AdvanceFocus(bool reverse); | |
| 65 | |
| 66 RenderViewImpl* render_view() { return render_view_; } | |
| 67 | |
| 68 private: | |
| 69 BrowserPlugin(RenderViewImpl* render_view, | |
| 70 WebKit::WebFrame* frame, | |
| 71 const WebKit::WebPluginParams& params, | |
| 72 const std::string& html_data); | |
| 73 virtual ~BrowserPlugin(); | |
| 74 | |
| 75 // Parses the source URL of the browser plugin from the element's attributes | |
| 76 // and outputs them. If not found, it outputs the defaults specified here as | |
| 77 // parameters. | |
| 78 void ParseSrcAttribute(const std::string& default_src, std::string* src); | |
| 79 // Replace the current guest with a new guest. | |
| 80 void Replace(webkit::ppapi::WebPluginImpl* new_plugin); | |
| 81 | |
| 82 RenderViewImpl* render_view_; | |
| 83 WebKit::WebPluginParams plugin_params_; | |
| 84 webkit::WebViewPlugin* placeholder_; | |
| 85 webkit::ppapi::WebPluginImpl* plugin_; | |
| 86 int id_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | |
| 89 }; | |
| 90 | |
| 91 } // namespace old | |
| 92 } // namespace content | |
| 93 | |
| 94 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_H_ | |
| OLD | NEW |