Permalink
Browse files

Add 'fullscreen' field in manifest.

  • Loading branch information...
1 parent 5309e31 commit 53da0ecd60c77cfe76930519d69df5adae0e7680 @zcbenz zcbenz committed Oct 6, 2012
Showing with 32 additions and 22 deletions.
  1. +21 −20 src/common/shell_switches.cc
  2. +1 −0 src/common/shell_switches.h
  3. +5 −2 src/nw_package.cc
  4. +5 −0 src/shell.cc
View
41 src/common/shell_switches.cc
@@ -52,25 +52,26 @@ const char kVersion[] = "version";
// Set current working directory
const char kWorkingDirectory[] = "working-directory";
-const char kmMain[] = "main";
-const char kmName[] = "name";
-const char kmWebkit[] = "webkit";
-const char kmNodejs[] = "nodejs";
-const char kmRoot[] = "root";
-const char kmWindow[] = "window";
-const char kmTitle[] = "title";
-const char kmToolbar[] = "toolbar";
-const char kmIcon[] = "icon";
-const char kmWidth[] = "width";
-const char kmHeight[] = "height";
-const char kmX[] = "x";
-const char kmY[] = "y";
-const char kmResizable[] = "resizable";
-const char kmPosition[] = "position";
-const char kmMinWidth[] = "min_width";
-const char kmMinHeight[] = "min_height";
-const char kmMaxWidth[] = "max_width";
-const char kmMaxHeight[] = "max_height";
-const char kmAsDesktop[] = "as_desktop";
+const char kmMain[] = "main";
+const char kmName[] = "name";
+const char kmWebkit[] = "webkit";
+const char kmNodejs[] = "nodejs";
+const char kmRoot[] = "root";
+const char kmWindow[] = "window";
+const char kmTitle[] = "title";
+const char kmToolbar[] = "toolbar";
+const char kmIcon[] = "icon";
+const char kmWidth[] = "width";
+const char kmHeight[] = "height";
+const char kmX[] = "x";
+const char kmY[] = "y";
+const char kmResizable[] = "resizable";
+const char kmPosition[] = "position";
+const char kmMinWidth[] = "min_width";
+const char kmMinHeight[] = "min_height";
+const char kmMaxWidth[] = "max_width";
+const char kmMaxHeight[] = "max_height";
+const char kmAsDesktop[] = "as_desktop";
+const char kmFullscreen[] = "fullscreen";
} // namespace switches
View
1 src/common/shell_switches.h
@@ -41,6 +41,7 @@ extern const char kmMinHeight[];
extern const char kmMaxWidth[];
extern const char kmMaxHeight[];
extern const char kmAsDesktop[];
+extern const char kmFullscreen[];
} // namespace switches
View
7 src/nw_package.cc
@@ -212,8 +212,11 @@ bool Package::InitFromPath() {
}
// Force window field no empty.
- if (!root_->HasKey(switches::kmWindow))
- root_->Set(switches::kmWindow, new base::DictionaryValue());
+ if (!root_->HasKey(switches::kmWindow)) {
+ base::DictionaryValue* window = new base::DictionaryValue();
+ window->SetString(switches::kmPosition, "center");
+ root_->Set(switches::kmWindow, window);
+ }
RelativePathToURI(path_, this->root());
return true;
View
5 src/shell.cc
@@ -113,6 +113,10 @@ Shell::Shell(WebContents* web_contents, base::DictionaryValue* manifest)
if (manifest->GetBoolean(switches::kmResizable, &resizable)) {
SetResizable(resizable);
}
+ bool fullscreen;
+ if (manifest->GetBoolean(switches::kmFullscreen, &fullscreen) && fullscreen) {
+ EnterFullscreen();
+ }
std::string title("node-webkit");
manifest->GetString(switches::kmTitle, &title);
SetTitle(title);
@@ -315,6 +319,7 @@ void Shell::WebContentsCreated(WebContents* source_contents,
// Get window features
WebKit::WebWindowFeatures features = new_contents->GetWindowFeatures();
manifest->SetBoolean(switches::kmResizable, features.resizable);
+ manifest->SetBoolean(switches::kmFullscreen, features.fullscreen);
if (features.widthSet)
manifest->SetInteger(switches::kmWidth, features.width);
if (features.heightSet)

0 comments on commit 53da0ec

Please sign in to comment.