Merge pull request #1837 from deepak1556/render_client_patch

renderer: option to override page visiblity state
This commit is contained in:
Cheng Zhao 2015-06-04 21:13:55 +08:00
commit a8256a62e0
6 changed files with 25 additions and 0 deletions

View file

@ -78,6 +78,7 @@ const char* kWebRuntimeFeatures[] = {
switches::kOverlayScrollbars,
switches::kOverlayFullscreenVideo,
switches::kSharedWorker,
switches::kPageVisibility,
};
std::string RemoveWhitespace(const std::string& str) {

View file

@ -95,6 +95,9 @@ const char kOverlayScrollbars[] = "overlay-scrollbars";
const char kOverlayFullscreenVideo[] = "overlay-fullscreen-video";
const char kSharedWorker[] = "shared-worker";
// Set page visiblity to always visible.
const char kPageVisibility[] = "page-visibility";
// Disable HTTP cache.
const char kDisableHttpCache[] = "disable-http-cache";

View file

@ -52,6 +52,7 @@ extern const char kSubpixelFontScaling[];
extern const char kOverlayScrollbars[];
extern const char kOverlayFullscreenVideo[];
extern const char kSharedWorker[];
extern const char kPageVisibility[];
extern const char kDisableHttpCache[];

View file

@ -191,6 +191,21 @@ content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate(
}
}
bool AtomRendererClient::ShouldOverridePageVisibilityState(
const content::RenderFrame* render_frame,
blink::WebPageVisibilityState* override_state) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
bool b;
if (IsSwitchEnabled(command_line, switches::kPageVisibility, &b)
&& b) {
*override_state = blink::WebPageVisibilityStateVisible;
return true;
}
return false;
}
void AtomRendererClient::EnableWebRuntimeFeatures() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
bool b;

View file

@ -55,6 +55,9 @@ class AtomRendererClient : public content::ContentRendererClient,
content::RenderFrame* render_frame,
const std::string& mime_type,
const GURL& original_url) override;
bool ShouldOverridePageVisibilityState(
const content::RenderFrame* render_frame,
blink::WebPageVisibilityState* override_state) override;
void EnableWebRuntimeFeatures();

View file

@ -97,6 +97,8 @@ You can also create a window without chrome by using
* `shared-worker` Boolean
* `direct-write` Boolean - Whether the DirectWrite font rendering system on
Windows is enabled
* `page-visibility` Boolean - Sets the page visibility state
to visible, prevents throttling of DOM timers.
Creates a new `BrowserWindow` with native properties set by the `options`.
Usually you only need to set the `width` and `height`, other properties will