@@ -569,27 +569,36 @@ void Shell::WebContentsCreated(WebContents* source_contents,
569
569
const GURL& target_url,
570
570
WebContents* new_contents,
571
571
const base::string16& nw_window_manifest) {
572
+
573
+ bool overwrite_manifest = true ;
574
+
572
575
// Create with package's manifest
573
576
scoped_ptr<base::DictionaryValue> manifest (
574
- GetPackage ()->window ()-> DeepCopy ());
577
+ GetPackage ()->GetNewWindow ());
575
578
576
579
scoped_ptr<base::Value> val;
577
580
std::string manifest_str = base::UTF16ToUTF8 (nw_window_manifest);
578
581
val.reset (base::JSONReader ().ReadToValue (manifest_str));
579
- if (val.get () && val->IsType (base::Value::TYPE_DICTIONARY))
582
+ if (val.get () && val->IsType (base::Value::TYPE_DICTIONARY)) {
580
583
manifest.reset (static_cast <base::DictionaryValue*>(val.release ()));
584
+ overwrite_manifest = false ;
585
+ }
581
586
582
587
// Get window features
583
588
blink::WebWindowFeatures features = new_contents->GetWindowFeatures ();
584
- manifest->SetBoolean (switches::kmResizable, features.resizable );
585
- manifest->SetBoolean (switches::kmFullscreen, features.fullscreen );
586
- if (features.widthSet )
589
+ if (overwrite_manifest || !manifest->HasKey (switches::kmResizable))
590
+ manifest->SetBoolean (switches::kmResizable, features.resizable );
591
+ if (overwrite_manifest || !manifest->HasKey (switches::kmFullscreen))
592
+ manifest->SetBoolean (switches::kmFullscreen, features.fullscreen );
593
+ if (overwrite_manifest || !manifest->HasKey (switches::kmToolbar))
594
+ manifest->SetBoolean (switches::kmToolbar, features.toolBarVisible );
595
+ if (features.widthSet && (overwrite_manifest || !manifest->HasKey (switches::kmWidth)))
587
596
manifest->SetInteger (switches::kmWidth, features.width );
588
- if (features.heightSet )
597
+ if (features.heightSet && (overwrite_manifest || !manifest-> HasKey (switches::kmHeight)) )
589
598
manifest->SetInteger (switches::kmHeight, features.height );
590
- if (features.xSet )
599
+ if (features.xSet && (overwrite_manifest || !manifest-> HasKey (switches::kmX)) )
591
600
manifest->SetInteger (switches::kmX, features.x );
592
- if (features.ySet )
601
+ if (features.ySet && (overwrite_manifest || !manifest-> HasKey (switches::kmY)) )
593
602
manifest->SetInteger (switches::kmY, features.y );
594
603
// window.open should show the window by default.
595
604
manifest->SetBoolean (switches::kmShow, true );
0 commit comments