Skip to content

Commit

Permalink
Merge pull request #221 from breach/script-context
Browse files Browse the repository at this point in the history
Review: Don't install bindings if not top frame [fix #220]
  • Loading branch information
Stanislas Polu committed Nov 10, 2014
2 parents 77287a2 + 79b9234 commit 18e5603
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thrust
Thrust
======

The require-able cross-platform native application framework based on Chromium's
Expand Down
12 changes: 12 additions & 0 deletions src/browser/thrust_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ ThrustWindow::PlatformCreateWindow(
set_background(views::Background::CreateStandardPanelBackground());
AddChildView(inspectable_web_contents()->GetView()->GetView());

#if defined(OS_WIN)
if (!has_frame_) {
/* Set Window style so that we get a minimize and maximize animation */
/* when frameless. */
DWORD frame_style = WS_THICKFRAME | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_CAPTION;
::SetWindowLong(
GetNativeWindow()->GetHost()->GetAcceleratedWidget(),
GWL_STYLE, frame_style);
}
#endif

window_->UpdateWindowIcon();
window_->CenterWindow(bounds.size());
Layout();
Expand Down
13 changes: 12 additions & 1 deletion src/renderer/renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/test/layouttest_support.h"

#include "src/common/switches.h"
Expand Down Expand Up @@ -135,7 +136,17 @@ ThrustShellRendererClient::DidCreateScriptContext(
int extension_group,
int world_id)
{
LOG(INFO) << "&&&&&&&&&&&&&&&&&&&&&&&&&&& DID CREATE SCRIPT CONTEXT `" << frame->uniqueName().utf8() << "`";
/* We limit the injection of WebViewBindings to the top level RenderFrames */
content::RenderFrame* render_frame =
content::RenderFrame::FromWebFrame(frame);
if(render_frame != render_frame->GetRenderView()->GetMainRenderFrame()) {
return;
}

LOG(INFO) << "ThrustShellRendererClient::DidCreateScriptContext `"
<< frame->uniqueName().utf8() << "` "
<< extension_group << " "
<< world_id;
ScriptContext* context = new ScriptContext(v8_context, frame);
{
scoped_ptr<ModuleSystem> module_system(new ModuleSystem(context,
Expand Down

0 comments on commit 18e5603

Please sign in to comment.