Avoid adding a new option to webPreferences
This commit is contained in:
parent
8f0e594007
commit
31eb793fb0
8 changed files with 8 additions and 28 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "atom/browser/native_window.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "base/command_line.h"
|
||||
|
@ -147,9 +148,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
|||
blink_features);
|
||||
|
||||
// The initial visibility state.
|
||||
std::string visibility;
|
||||
if (web_preferences.GetString(options::kVisibilityState, &visibility))
|
||||
command_line->AppendSwitchASCII(switches::kVisibilityState, visibility);
|
||||
NativeWindow* window = NativeWindow::FromWebContents(web_contents);
|
||||
if (window) {
|
||||
bool visible = window->IsVisible() && !window->IsMinimized();
|
||||
if (!visible) // Default state is visible.
|
||||
command_line->AppendSwitch("hidden-page");
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue