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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 window_->SetName("RenderWidgetHostViewAura"); | 328 window_->SetName("RenderWidgetHostViewAura"); |
329 | 329 |
330 aura::Window* parent = NULL; | 330 aura::Window* parent = NULL; |
331 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); | 331 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); |
332 aura::client::ScreenPositionClient* screen_position_client = | 332 aura::client::ScreenPositionClient* screen_position_client = |
333 aura::client::GetScreenPositionClient(root); | 333 aura::client::GetScreenPositionClient(root); |
334 if (screen_position_client) { | 334 if (screen_position_client) { |
335 gfx::Point origin_in_screen(bounds_in_display.origin()); | 335 gfx::Point origin_in_screen(bounds_in_display.origin()); |
336 screen_position_client->ConvertPointToScreen(root, &origin_in_screen); | 336 screen_position_client->ConvertPointToScreen(root, &origin_in_screen); |
337 parent = aura::client::GetStackingClient()->GetDefaultParent( | 337 parent = aura::client::GetStackingClient()->GetDefaultParent( |
338 window_, gfx::Rect(origin_in_screen, bounds_in_display.size())); | 338 window_, window_, |
| 339 gfx::Rect(origin_in_screen, bounds_in_display.size())); |
339 } | 340 } |
340 window_->SetParent(parent); | 341 window_->SetParent(parent); |
341 SetBounds(bounds_in_display); | 342 SetBounds(bounds_in_display); |
342 Show(); | 343 Show(); |
343 } | 344 } |
344 | 345 |
345 void RenderWidgetHostViewAura::InitAsFullscreen( | 346 void RenderWidgetHostViewAura::InitAsFullscreen( |
346 RenderWidgetHostView* reference_host_view) { | 347 RenderWidgetHostView* reference_host_view) { |
347 is_fullscreen_ = true; | 348 is_fullscreen_ = true; |
348 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 349 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
349 window_->Init(ui::LAYER_TEXTURED); | 350 window_->Init(ui::LAYER_TEXTURED); |
350 window_->SetName("RenderWidgetHostViewAura"); | 351 window_->SetName("RenderWidgetHostViewAura"); |
351 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 352 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
352 aura::Window* parent = NULL; | 353 aura::Window* parent = NULL; |
353 if (reference_host_view) { | 354 if (reference_host_view) { |
354 aura::Window* reference_window = | 355 aura::Window* reference_window = |
355 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 356 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
356 if (reference_window) { | 357 if (reference_window) { |
357 host_tracker_.reset(new aura::WindowTracker); | 358 host_tracker_.reset(new aura::WindowTracker); |
358 host_tracker_->Add(reference_window); | 359 host_tracker_->Add(reference_window); |
359 } | 360 } |
360 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 361 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
361 GetDisplayNearestWindow(reference_window); | 362 GetDisplayNearestWindow(reference_window); |
362 aura::client::StackingClient* stacking_client = | 363 aura::client::StackingClient* stacking_client = |
363 aura::client::GetStackingClient(); | 364 aura::client::GetStackingClient(); |
364 if (stacking_client) | 365 if (stacking_client) |
365 parent = stacking_client->GetDefaultParent(window_, display.bounds()); | 366 parent = stacking_client->GetDefaultParent( |
| 367 window_, window_, display.bounds()); |
366 } | 368 } |
367 window_->SetParent(parent); | 369 window_->SetParent(parent); |
368 Show(); | 370 Show(); |
369 Focus(); | 371 Focus(); |
370 } | 372 } |
371 | 373 |
372 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 374 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
373 return host_; | 375 return host_; |
374 } | 376 } |
375 | 377 |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 RenderWidgetHost* widget) { | 1979 RenderWidgetHost* widget) { |
1978 return new RenderWidgetHostViewAura(widget); | 1980 return new RenderWidgetHostViewAura(widget); |
1979 } | 1981 } |
1980 | 1982 |
1981 // static | 1983 // static |
1982 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1984 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1983 GetScreenInfoForWindow(results, NULL); | 1985 GetScreenInfoForWindow(results, NULL); |
1984 } | 1986 } |
1985 | 1987 |
1986 } // namespace content | 1988 } // namespace content |
OLD | NEW |