Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
allow enabling of preferred size mode for non-mac os
Browse files Browse the repository at this point in the history
auditors: @bbondy
  • Loading branch information
bridiver committed Sep 14, 2016
1 parent a007f59 commit e31e27c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ std::unique_ptr<content::BluetoothChooser> WebContents::RunBluetoothChooser(
return std::move(bluetooth_chooser);
}

void WebContents::EnablePreferredSizeMode(bool enable) {
web_contents()->GetRenderViewHost()->EnablePreferredSizeMode();
}

void WebContents::UpdatePreferredSize(content::WebContents* web_contents,
const gfx::Size& pref_size) {
Emit("preferred-size-changed", pref_size);
Expand Down Expand Up @@ -2003,6 +2007,8 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
&WebContents::ZoomReset)
.SetMethod("getZoomPercent",
&WebContents::GetZoomPercent)
.SetMethod("enablePreferredSizeMode",
&WebContents::EnablePreferredSizeMode)
#if defined(ENABLE_EXTENSIONS)
.SetMethod("executeScriptInTab", &WebContents::ExecuteScriptInTab)
#endif
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_web_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// done.
void CapturePage(mate::Arguments* args);

void EnablePreferredSizeMode(bool enable);
gfx::Size GetPreferredSize();

// Methods for creating <webview>.
Expand Down
1 change: 1 addition & 0 deletions lib/renderer/web-view/web-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ var registerWebViewElement = function () {
'zoomOut',
'zoomReset',
'getZoomPercent',
'enablePreferredSizeMode',
'getPreferredSize'
]
nonblockMethods = [
Expand Down

1 comment on commit e31e27c

@bbondy
Copy link
Member

@bbondy bbondy commented on e31e27c Sep 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.