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

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: I think the content_unittests timeout on linux_aura is flake, but try to fix it anyway. Created 8 years, 1 month 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // similar mechanism to ensure a second popup doesn't cause the first one 315 // similar mechanism to ensure a second popup doesn't cause the first one
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::Window* parent = NULL;
326 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); 325 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow();
326
327 // TODO(erg): While I could make sure details of the StackingClient are
sky 2012/11/21 23:35:59 Oshima is changing this at https://codereview.chro
328 // hidden behind aura, hiding the details of the ScreenPositionClient will
329 // take another effort.
330 gfx::Point origin_in_screen(bounds_in_display.origin());
327 aura::client::ScreenPositionClient* screen_position_client = 331 aura::client::ScreenPositionClient* screen_position_client =
328 aura::client::GetScreenPositionClient(root); 332 aura::client::GetScreenPositionClient(root);
329 if (screen_position_client) { 333 if (screen_position_client)
330 gfx::Point origin_in_screen(bounds_in_display.origin());
331 screen_position_client->ConvertPointToScreen(root, &origin_in_screen); 334 screen_position_client->ConvertPointToScreen(root, &origin_in_screen);
332 parent = aura::client::GetStackingClient()->GetDefaultParent( 335
333 window_, window_, 336 window_->SetDefaultParentByTargetRoot(
334 gfx::Rect(origin_in_screen, bounds_in_display.size())); 337 root,
335 } 338 gfx::Rect(origin_in_screen, bounds_in_display.size()));
336 window_->SetParent(parent);
337 SetBounds(bounds_in_display); 339 SetBounds(bounds_in_display);
338 Show(); 340 Show();
339 } 341 }
340 342
341 void RenderWidgetHostViewAura::InitAsFullscreen( 343 void RenderWidgetHostViewAura::InitAsFullscreen(
342 RenderWidgetHostView* reference_host_view) { 344 RenderWidgetHostView* reference_host_view) {
343 is_fullscreen_ = true; 345 is_fullscreen_ = true;
344 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); 346 window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
345 window_->Init(ui::LAYER_TEXTURED); 347 window_->Init(ui::LAYER_TEXTURED);
346 window_->SetName("RenderWidgetHostViewAura"); 348 window_->SetName("RenderWidgetHostViewAura");
347 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 349 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
348 aura::Window* parent = NULL; 350
351 aura::RootWindow* parent = NULL;
352 gfx::Rect bounds;
349 if (reference_host_view) { 353 if (reference_host_view) {
350 aura::Window* reference_window = 354 aura::Window* reference_window =
351 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; 355 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
352 if (reference_window) { 356 if (reference_window) {
353 host_tracker_.reset(new aura::WindowTracker); 357 host_tracker_.reset(new aura::WindowTracker);
354 host_tracker_->Add(reference_window); 358 host_tracker_->Add(reference_window);
355 } 359 }
356 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 360 gfx::Display display = gfx::Screen::GetScreenFor(window_)->
357 GetDisplayNearestWindow(reference_window); 361 GetDisplayNearestWindow(reference_window);
358 aura::client::StackingClient* stacking_client = 362 parent = reference_window->GetRootWindow();
359 aura::client::GetStackingClient(); 363 bounds = display.bounds();
360 if (stacking_client)
361 parent = stacking_client->GetDefaultParent(
362 window_, window_, display.bounds());
363 } 364 }
364 window_->SetParent(parent); 365 window_->SetDefaultParentByTargetRoot(parent, bounds);
366
365 Show(); 367 Show();
366 Focus(); 368 Focus();
367 } 369 }
368 370
369 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { 371 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const {
370 return host_; 372 return host_;
371 } 373 }
372 374
373 void RenderWidgetHostViewAura::WasShown() { 375 void RenderWidgetHostViewAura::WasShown() {
374 if (!host_->is_hidden()) 376 if (!host_->is_hidden())
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 RenderWidgetHost* widget) { 1993 RenderWidgetHost* widget) {
1992 return new RenderWidgetHostViewAura(widget); 1994 return new RenderWidgetHostViewAura(widget);
1993 } 1995 }
1994 1996
1995 // static 1997 // static
1996 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1998 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1997 GetScreenInfoForWindow(results, NULL); 1999 GetScreenInfoForWindow(results, NULL);
1998 } 2000 }
1999 2001
2000 } // namespace content 2002 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698