Skip to content

Commit 18e5603

Browse files
author
Stanislas Polu
committed
Merge pull request #221 from breach/script-context
Review: Don't install bindings if not top frame [fix #220]
2 parents 77287a2 + 79b9234 commit 18e5603

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thrust
1+
Thrust
22
======
33

44
The require-able cross-platform native application framework based on Chromium's

src/browser/thrust_window_views.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,18 @@ ThrustWindow::PlatformCreateWindow(
259259
set_background(views::Background::CreateStandardPanelBackground());
260260
AddChildView(inspectable_web_contents()->GetView()->GetView());
261261

262+
#if defined(OS_WIN)
263+
if (!has_frame_) {
264+
/* Set Window style so that we get a minimize and maximize animation */
265+
/* when frameless. */
266+
DWORD frame_style = WS_THICKFRAME | WS_MINIMIZEBOX |
267+
WS_MAXIMIZEBOX | WS_CAPTION;
268+
::SetWindowLong(
269+
GetNativeWindow()->GetHost()->GetAcceleratedWidget(),
270+
GWL_STYLE, frame_style);
271+
}
272+
#endif
273+
262274
window_->UpdateWindowIcon();
263275
window_->CenterWindow(bounds.size());
264276
Layout();

src/renderer/renderer_client.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "content/public/common/content_switches.h"
2222
#include "content/public/renderer/render_thread.h"
2323
#include "content/public/renderer/render_view.h"
24+
#include "content/public/renderer/render_frame.h"
2425
#include "content/public/test/layouttest_support.h"
2526

2627
#include "src/common/switches.h"
@@ -135,7 +136,17 @@ ThrustShellRendererClient::DidCreateScriptContext(
135136
int extension_group,
136137
int world_id)
137138
{
138-
LOG(INFO) << "&&&&&&&&&&&&&&&&&&&&&&&&&&& DID CREATE SCRIPT CONTEXT `" << frame->uniqueName().utf8() << "`";
139+
/* We limit the injection of WebViewBindings to the top level RenderFrames */
140+
content::RenderFrame* render_frame =
141+
content::RenderFrame::FromWebFrame(frame);
142+
if(render_frame != render_frame->GetRenderView()->GetMainRenderFrame()) {
143+
return;
144+
}
145+
146+
LOG(INFO) << "ThrustShellRendererClient::DidCreateScriptContext `"
147+
<< frame->uniqueName().utf8() << "` "
148+
<< extension_group << " "
149+
<< world_id;
139150
ScriptContext* context = new ScriptContext(v8_context, frame);
140151
{
141152
scoped_ptr<ModuleSystem> module_system(new ModuleSystem(context,

0 commit comments

Comments
 (0)