OLD | NEW |
---|---|
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 Loading... | |
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. | |
331 gfx::Point origin_in_screen(bounds_in_screen.origin()); | |
330 aura::client::ScreenPositionClient* screen_position_client = | 332 aura::client::ScreenPositionClient* screen_position_client = |
331 aura::client::GetScreenPositionClient(root); | 333 aura::client::GetScreenPositionClient(root); |
332 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->ConvertPointToScreen(root, &origin_in_screen); |
335 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size())); | 336 SetBounds(gfx::Rect(origin_in_screen, bounds_in_screen.size())); |
oshima
2012/11/27 00:14:30
This will break chromeos/win_ash. The bounds_in_sc
Elliot Glaysher
2012/11/27 00:33:51
I changed this to be what it used to be, and grabb
| |
336 Show(); | 337 Show(); |
337 } | 338 } |
338 | 339 |
339 void RenderWidgetHostViewAura::InitAsFullscreen( | 340 void RenderWidgetHostViewAura::InitAsFullscreen( |
340 RenderWidgetHostView* reference_host_view) { | 341 RenderWidgetHostView* reference_host_view) { |
341 is_fullscreen_ = true; | 342 is_fullscreen_ = true; |
342 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 343 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
343 window_->Init(ui::LAYER_TEXTURED); | 344 window_->Init(ui::LAYER_TEXTURED); |
344 window_->SetName("RenderWidgetHostViewAura"); | 345 window_->SetName("RenderWidgetHostViewAura"); |
345 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 346 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
346 aura::Window* parent = NULL; | 347 |
348 aura::RootWindow* parent = NULL; | |
349 gfx::Rect bounds; | |
347 if (reference_host_view) { | 350 if (reference_host_view) { |
348 aura::Window* reference_window = | 351 aura::Window* reference_window = |
349 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 352 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
350 if (reference_window) { | 353 if (reference_window) { |
351 host_tracker_.reset(new aura::WindowTracker); | 354 host_tracker_.reset(new aura::WindowTracker); |
352 host_tracker_->Add(reference_window); | 355 host_tracker_->Add(reference_window); |
353 } | 356 } |
354 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 357 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
355 GetDisplayNearestWindow(reference_window); | 358 GetDisplayNearestWindow(reference_window); |
356 aura::client::StackingClient* stacking_client = | 359 parent = reference_window->GetRootWindow(); |
357 aura::client::GetStackingClient(); | 360 bounds = display.bounds(); |
358 if (stacking_client) | |
359 parent = stacking_client->GetDefaultParent( | |
360 window_, window_, display.bounds()); | |
361 } | 361 } |
362 window_->SetParent(parent); | 362 window_->SetDefaultParentByRootWindow(parent, bounds); |
363 | |
363 Show(); | 364 Show(); |
364 Focus(); | 365 Focus(); |
365 } | 366 } |
366 | 367 |
367 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 368 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
368 return host_; | 369 return host_; |
369 } | 370 } |
370 | 371 |
371 void RenderWidgetHostViewAura::WasShown() { | 372 void RenderWidgetHostViewAura::WasShown() { |
372 if (!host_->is_hidden()) | 373 if (!host_->is_hidden()) |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 RenderWidgetHost* widget) { | 1994 RenderWidgetHost* widget) { |
1994 return new RenderWidgetHostViewAura(widget); | 1995 return new RenderWidgetHostViewAura(widget); |
1995 } | 1996 } |
1996 | 1997 |
1997 // static | 1998 // static |
1998 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1999 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1999 GetScreenInfoForWindow(results, NULL); | 2000 GetScreenInfoForWindow(results, NULL); |
2000 } | 2001 } |
2001 | 2002 |
2002 } // namespace content | 2003 } // namespace content |
OLD | NEW |