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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 window_->SetName("RenderWidgetHostViewAura"); | 318 window_->SetName("RenderWidgetHostViewAura"); |
319 | 319 |
320 aura::Window* parent = NULL; | 320 aura::Window* parent = NULL; |
321 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); | 321 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); |
322 aura::client::ScreenPositionClient* screen_position_client = | 322 aura::client::ScreenPositionClient* screen_position_client = |
323 aura::client::GetScreenPositionClient(root); | 323 aura::client::GetScreenPositionClient(root); |
324 if (screen_position_client) { | 324 if (screen_position_client) { |
325 gfx::Point origin_in_screen(bounds_in_display.origin()); | 325 gfx::Point origin_in_screen(bounds_in_display.origin()); |
326 screen_position_client->ConvertPointToScreen(root, &origin_in_screen); | 326 screen_position_client->ConvertPointToScreen(root, &origin_in_screen); |
327 parent = aura::client::GetStackingClient()->GetDefaultParent( | 327 parent = aura::client::GetStackingClient()->GetDefaultParent( |
328 window_, gfx::Rect(origin_in_screen, bounds_in_display.size())); | 328 window_, window_, |
| 329 gfx::Rect(origin_in_screen, bounds_in_display.size())); |
329 } | 330 } |
330 window_->SetParent(parent); | 331 window_->SetParent(parent); |
331 SetBounds(bounds_in_display); | 332 SetBounds(bounds_in_display); |
332 Show(); | 333 Show(); |
333 } | 334 } |
334 | 335 |
335 void RenderWidgetHostViewAura::InitAsFullscreen( | 336 void RenderWidgetHostViewAura::InitAsFullscreen( |
336 RenderWidgetHostView* reference_host_view) { | 337 RenderWidgetHostView* reference_host_view) { |
337 is_fullscreen_ = true; | 338 is_fullscreen_ = true; |
338 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 339 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
339 window_->Init(ui::LAYER_TEXTURED); | 340 window_->Init(ui::LAYER_TEXTURED); |
340 window_->SetName("RenderWidgetHostViewAura"); | 341 window_->SetName("RenderWidgetHostViewAura"); |
341 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 342 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
342 aura::Window* parent = NULL; | 343 aura::Window* parent = NULL; |
343 if (reference_host_view) { | 344 if (reference_host_view) { |
344 aura::Window* reference_window = | 345 aura::Window* reference_window = |
345 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 346 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
346 if (reference_window) { | 347 if (reference_window) { |
347 host_tracker_.reset(new aura::WindowTracker); | 348 host_tracker_.reset(new aura::WindowTracker); |
348 host_tracker_->Add(reference_window); | 349 host_tracker_->Add(reference_window); |
349 } | 350 } |
350 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 351 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
351 GetDisplayNearestWindow(reference_window); | 352 GetDisplayNearestWindow(reference_window); |
352 aura::client::StackingClient* stacking_client = | 353 aura::client::StackingClient* stacking_client = |
353 aura::client::GetStackingClient(); | 354 aura::client::GetStackingClient(); |
354 if (stacking_client) | 355 if (stacking_client) |
355 parent = stacking_client->GetDefaultParent(window_, display.bounds()); | 356 parent = stacking_client->GetDefaultParent( |
| 357 window_, window_, display.bounds()); |
356 } | 358 } |
357 window_->SetParent(parent); | 359 window_->SetParent(parent); |
358 Show(); | 360 Show(); |
359 Focus(); | 361 Focus(); |
360 } | 362 } |
361 | 363 |
362 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 364 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
363 return host_; | 365 return host_; |
364 } | 366 } |
365 | 367 |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 RenderWidgetHost* widget) { | 1962 RenderWidgetHost* widget) { |
1961 return new RenderWidgetHostViewAura(widget); | 1963 return new RenderWidgetHostViewAura(widget); |
1962 } | 1964 } |
1963 | 1965 |
1964 // static | 1966 // static |
1965 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1967 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1966 GetScreenInfoForWindow(results, NULL); | 1968 GetScreenInfoForWindow(results, NULL); |
1967 } | 1969 } |
1968 | 1970 |
1969 } // namespace content | 1971 } // namespace content |
OLD | NEW |