Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2240)

Unified Diff: content/shell/browser/shell.cc

Issue 783203002: Add --content-shell-host-window-size switch to control the window size for content_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename commandline switch as per review comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/shell/common/shell_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell.cc
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index c2967afd5997fd4e42fb3c52cb32a452b725aeac..efddc3e748f0c06d9367d4bd7ff20ceae8eb63b6 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -39,6 +39,26 @@ base::Callback<void(Shell*)> Shell::shell_created_callback_;
bool Shell::quit_message_loop_ = true;
+namespace {
+gfx::Size ShellDefaultSize() {
+ static gfx::Size default_shell_size;
+ if (!default_shell_size.IsEmpty())
+ return default_shell_size;
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kContentShellHostWindowSize)) {
+ const std::string size_str = command_line->GetSwitchValueASCII(
+ switches::kContentShellHostWindowSize);
+ int width, height;
+ CHECK_EQ(2, sscanf(size_str.c_str(), "%dx%d", &width, &height));
+ default_shell_size = gfx::Size(width, height);
+ } else {
+ default_shell_size = gfx::Size(
+ Shell::kDefaultTestWindowWidthDip, Shell::kDefaultTestWindowHeightDip);
+ }
+ return default_shell_size;
+}
+} // namespace
+
class Shell::DevToolsWebContentsObserver : public WebContentsObserver {
public:
DevToolsWebContentsObserver(Shell* shell, WebContents* web_contents)
@@ -141,14 +161,13 @@ Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) {
// static
void Shell::Initialize() {
- PlatformInitialize(
- gfx::Size(kDefaultTestWindowWidthDip, kDefaultTestWindowHeightDip));
+ PlatformInitialize(ShellDefaultSize());
}
gfx::Size Shell::AdjustWindowSize(const gfx::Size& initial_size) {
if (!initial_size.IsEmpty())
return initial_size;
- return gfx::Size(kDefaultTestWindowWidthDip, kDefaultTestWindowHeightDip);
+ return ShellDefaultSize();
}
Shell* Shell::CreateNewWindow(BrowserContext* browser_context,
« no previous file with comments | « no previous file | content/shell/common/shell_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698