Fix webview for the new API

This commit is contained in:
Cheng Zhao 2015-03-13 16:33:06 -07:00
parent 8328bce3f6
commit 12d5474077
7 changed files with 78 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include "atom/common/node_bindings.h"
#include "atom/common/options_switches.h"
#include "atom/renderer/atom_render_view_observer.h"
#include "atom/renderer/guest_view_container.h"
#include "chrome/renderer/printing/print_web_view_helper.h"
#include "chrome/renderer/tts_dispatcher.h"
#include "content/public/common/content_constants.h"
@ -149,6 +150,17 @@ bool AtomRendererClient::ShouldFork(blink::WebFrame* frame,
return http_method == "GET";
}
content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const std::string& mime_type,
const GURL& original_url) {
if (mime_type == content::kBrowserPluginMimeType) {
return new GuestViewContainer(render_frame);
} else {
return nullptr;
}
}
void AtomRendererClient::EnableWebRuntimeFeatures() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
bool b;

View file

@ -51,6 +51,10 @@ class AtomRendererClient : public content::ContentRendererClient,
bool is_initial_navigation,
bool is_server_redirect,
bool* send_referrer) override;
content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const std::string& mime_type,
const GURL& original_url) override;
void EnableWebRuntimeFeatures();

View file

@ -0,0 +1,15 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/renderer/guest_view_container.h"
namespace atom {
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame) {
}
GuestViewContainer::~GuestViewContainer() {
}
} // namespace atom

View file

@ -0,0 +1,24 @@
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
#define ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_
#include "content/public/renderer/browser_plugin_delegate.h"
#include "v8/include/v8.h"
namespace atom {
class GuestViewContainer : public content::BrowserPluginDelegate {
public:
explicit GuestViewContainer(content::RenderFrame* render_frame);
~GuestViewContainer() override;
private:
DISALLOW_COPY_AND_ASSIGN(GuestViewContainer);
};
} // namespace atom
#endif // ATOM_RENDERER_GUEST_VIEW_CONTAINER_H_