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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 11421006: Desktop aura: Break aura::Window::SetParent in two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Further renames for oshima Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // to never get a chance to filter events. See crbug.com/160589. 316 // to never get a chance to filter events. See crbug.com/160589.
317 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); 317 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_);
318 old_child->popup_parent_host_view_ = NULL; 318 old_child->popup_parent_host_view_ = NULL;
319 } 319 }
320 popup_parent_host_view_->popup_child_host_view_ = this; 320 popup_parent_host_view_->popup_child_host_view_ = this;
321 window_->SetType(aura::client::WINDOW_TYPE_MENU); 321 window_->SetType(aura::client::WINDOW_TYPE_MENU);
322 window_->Init(ui::LAYER_TEXTURED); 322 window_->Init(ui::LAYER_TEXTURED);
323 window_->SetName("RenderWidgetHostViewAura"); 323 window_->SetName("RenderWidgetHostViewAura");
324 324
325 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); 325 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow();
326 aura::Window* parent = aura::client::GetStackingClient()->GetDefaultParent( 326 window_->SetDefaultParentByRootWindow(root, bounds_in_screen);
327 window_, window_, bounds_in_screen);
328 window_->SetParent(parent);
329 327
328 // TODO(erg): While I could make sure details of the StackingClient are
329 // hidden behind aura, hiding the details of the ScreenPositionClient will
330 // take another effort.
330 aura::client::ScreenPositionClient* screen_position_client = 331 aura::client::ScreenPositionClient* screen_position_client =
331 aura::client::GetScreenPositionClient(root); 332 aura::client::GetScreenPositionClient(root);
332 gfx::Point origin_in_parent(bounds_in_screen.origin()); 333 gfx::Point origin_in_parent(bounds_in_screen.origin());
333 if (screen_position_client) 334 if (screen_position_client) {
334 screen_position_client->ConvertPointFromScreen(parent, &origin_in_parent); 335 screen_position_client->ConvertPointFromScreen(
336 window_->parent(), &origin_in_parent);
337 }
335 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size())); 338 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size()));
336 Show(); 339 Show();
337 } 340 }
338 341
339 void RenderWidgetHostViewAura::InitAsFullscreen( 342 void RenderWidgetHostViewAura::InitAsFullscreen(
340 RenderWidgetHostView* reference_host_view) { 343 RenderWidgetHostView* reference_host_view) {
341 is_fullscreen_ = true; 344 is_fullscreen_ = true;
342 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); 345 window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
343 window_->Init(ui::LAYER_TEXTURED); 346 window_->Init(ui::LAYER_TEXTURED);
344 window_->SetName("RenderWidgetHostViewAura"); 347 window_->SetName("RenderWidgetHostViewAura");
345 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 348 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
346 aura::Window* parent = NULL; 349
350 aura::RootWindow* parent = NULL;
351 gfx::Rect bounds;
347 if (reference_host_view) { 352 if (reference_host_view) {
348 aura::Window* reference_window = 353 aura::Window* reference_window =
349 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; 354 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
350 if (reference_window) { 355 if (reference_window) {
351 host_tracker_.reset(new aura::WindowTracker); 356 host_tracker_.reset(new aura::WindowTracker);
352 host_tracker_->Add(reference_window); 357 host_tracker_->Add(reference_window);
353 } 358 }
354 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 359 gfx::Display display = gfx::Screen::GetScreenFor(window_)->
355 GetDisplayNearestWindow(reference_window); 360 GetDisplayNearestWindow(reference_window);
356 aura::client::StackingClient* stacking_client = 361 parent = reference_window->GetRootWindow();
357 aura::client::GetStackingClient(); 362 bounds = display.bounds();
358 if (stacking_client)
359 parent = stacking_client->GetDefaultParent(
360 window_, window_, display.bounds());
361 } 363 }
362 window_->SetParent(parent); 364 window_->SetDefaultParentByRootWindow(parent, bounds);
365
363 Show(); 366 Show();
364 Focus(); 367 Focus();
365 } 368 }
366 369
367 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { 370 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const {
368 return host_; 371 return host_;
369 } 372 }
370 373
371 void RenderWidgetHostViewAura::WasShown() { 374 void RenderWidgetHostViewAura::WasShown() {
372 if (!host_->is_hidden()) 375 if (!host_->is_hidden())
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 RenderWidgetHost* widget) { 1996 RenderWidgetHost* widget) {
1994 return new RenderWidgetHostViewAura(widget); 1997 return new RenderWidgetHostViewAura(widget);
1995 } 1998 }
1996 1999
1997 // static 2000 // static
1998 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2001 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1999 GetScreenInfoForWindow(results, NULL); 2002 GetScreenInfoForWindow(results, NULL);
2000 } 2003 }
2001 2004
2002 } // namespace content 2005 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698