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

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: Re-add parent finding thing to web_contents_view_aura.cc. I guess it was necessary after all? 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 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();
327 aura::client::ScreenPositionClient* screen_position_client = 326 window_->SetDefaultParentByTargetRoot(root);
328 aura::client::GetScreenPositionClient(root); 327
329 if (screen_position_client) {
330 gfx::Point origin_in_screen(bounds_in_display.origin());
331 screen_position_client->ConvertPointToScreen(root, &origin_in_screen);
332 parent = aura::client::GetStackingClient()->GetDefaultParent(
333 window_, window_,
334 gfx::Rect(origin_in_screen, bounds_in_display.size()));
335 }
336 window_->SetParent(parent);
337 SetBounds(bounds_in_display); 328 SetBounds(bounds_in_display);
338 Show(); 329 Show();
339 } 330 }
340 331
341 void RenderWidgetHostViewAura::InitAsFullscreen( 332 void RenderWidgetHostViewAura::InitAsFullscreen(
342 RenderWidgetHostView* reference_host_view) { 333 RenderWidgetHostView* reference_host_view) {
343 is_fullscreen_ = true; 334 is_fullscreen_ = true;
344 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); 335 window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
345 window_->Init(ui::LAYER_TEXTURED); 336 window_->Init(ui::LAYER_TEXTURED);
346 window_->SetName("RenderWidgetHostViewAura"); 337 window_->SetName("RenderWidgetHostViewAura");
347 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 338 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
339
340 // ---------------------- FIX ME --------------------------
348 aura::Window* parent = NULL; 341 aura::Window* parent = NULL;
349 if (reference_host_view) { 342 if (reference_host_view) {
350 aura::Window* reference_window = 343 aura::Window* reference_window =
351 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; 344 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
352 if (reference_window) { 345 if (reference_window) {
353 host_tracker_.reset(new aura::WindowTracker); 346 host_tracker_.reset(new aura::WindowTracker);
354 host_tracker_->Add(reference_window); 347 host_tracker_->Add(reference_window);
355 } 348 }
356 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> 349 gfx::Display display = gfx::Screen::GetScreenFor(window_)->
357 GetDisplayNearestWindow(reference_window); 350 GetDisplayNearestWindow(reference_window);
358 aura::client::StackingClient* stacking_client = 351 aura::client::StackingClient* stacking_client =
359 aura::client::GetStackingClient(); 352 aura::client::GetStackingClient(reference_window);
360 if (stacking_client) 353 if (stacking_client)
361 parent = stacking_client->GetDefaultParent( 354 parent = stacking_client->GetDefaultParent(
362 window_, window_, display.bounds()); 355 window_, window_, display.bounds());
363 } 356 }
364 window_->SetParent(parent); 357 window_->SetParentTo(parent);
358 // ---------------------- /FIX ME --------------------------
359
365 Show(); 360 Show();
366 Focus(); 361 Focus();
367 } 362 }
368 363
369 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { 364 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const {
370 return host_; 365 return host_;
371 } 366 }
372 367
373 void RenderWidgetHostViewAura::WasShown() { 368 void RenderWidgetHostViewAura::WasShown() {
374 if (!host_->is_hidden()) 369 if (!host_->is_hidden())
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 RenderWidgetHost* widget) { 1986 RenderWidgetHost* widget) {
1992 return new RenderWidgetHostViewAura(widget); 1987 return new RenderWidgetHostViewAura(widget);
1993 } 1988 }
1994 1989
1995 // static 1990 // static
1996 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1991 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1997 GetScreenInfoForWindow(results, NULL); 1992 GetScreenInfoForWindow(results, NULL);
1998 } 1993 }
1999 1994
2000 } // namespace content 1995 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698