Index: content/browser/web_contents/web_contents_view_aura.cc |
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc |
index a6c8cf4087953ee199256c17e2f581ca0d1b5e4b..4b9e9ce16e27426b9be3a1befe7b7d571c583366 100644 |
--- a/content/browser/web_contents/web_contents_view_aura.cc |
+++ b/content/browser/web_contents/web_contents_view_aura.cc |
@@ -634,10 +634,18 @@ void WebContentsViewAura::CreateView( |
window_->SetType(aura::client::WINDOW_TYPE_CONTROL); |
window_->SetTransparent(false); |
window_->Init(ui::LAYER_NOT_DRAWN); |
- // TODO(mukai, erg): Should use a non-NULL value later when the DCHECK is |
- // turned on in SetDefaultParentByRootWindow(). |
- aura::RootWindow* target_root = context ? context->GetRootWindow() : NULL; |
- window_->SetDefaultParentByRootWindow(target_root, gfx::Rect()); |
+ if (context) { |
+ // There are places where there is no context currently because object |
+ // hierarchies are built before they're attached to a Widget. (See |
+ // views::WebView as an example; GetWidget() returns NULL at the point |
+ // where we are created.) |
+ // |
+ // It should be OK to not set a default parent since such users will |
+ // explicitly add this WebContentsViewAura to their tree after they create |
+ // us. |
+ window_->SetDefaultParentByRootWindow(context->GetRootWindow(), |
+ gfx::Rect()); |
+ } |
window_->layer()->SetMasksToBounds(true); |
window_->SetName("WebContentsViewAura"); |