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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 470 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
471 OnTextInputStateChanged) | 471 OnTextInputStateChanged) |
472 IPC_MESSAGE_UNHANDLED(handled = false) | 472 IPC_MESSAGE_UNHANDLED(handled = false) |
473 IPC_END_MESSAGE_MAP() | 473 IPC_END_MESSAGE_MAP() |
474 return handled; | 474 return handled; |
475 } | 475 } |
476 | 476 |
477 void RenderWidgetHostViewAura::InitAsChild( | 477 void RenderWidgetHostViewAura::InitAsChild( |
478 gfx::NativeView parent_view) { | 478 gfx::NativeView parent_view) { |
479 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 479 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
480 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 480 window_->Init(ui::LAYER_SOLID_COLOR); |
481 window_->SetName("RenderWidgetHostViewAura"); | 481 window_->SetName("RenderWidgetHostViewAura"); |
482 window_->layer()->SetColor(background_color_); | 482 window_->layer()->SetColor(background_color_); |
483 } | 483 } |
484 | 484 |
485 void RenderWidgetHostViewAura::InitAsPopup( | 485 void RenderWidgetHostViewAura::InitAsPopup( |
486 RenderWidgetHostView* parent_host_view, | 486 RenderWidgetHostView* parent_host_view, |
487 const gfx::Rect& bounds_in_screen) { | 487 const gfx::Rect& bounds_in_screen) { |
488 popup_parent_host_view_ = | 488 popup_parent_host_view_ = |
489 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 489 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
490 | 490 |
491 // TransientWindowClient may be NULL during tests. | 491 // TransientWindowClient may be NULL during tests. |
492 aura::client::TransientWindowClient* transient_window_client = | 492 aura::client::TransientWindowClient* transient_window_client = |
493 aura::client::GetTransientWindowClient(); | 493 aura::client::GetTransientWindowClient(); |
494 RenderWidgetHostViewAura* old_child = | 494 RenderWidgetHostViewAura* old_child = |
495 popup_parent_host_view_->popup_child_host_view_; | 495 popup_parent_host_view_->popup_child_host_view_; |
496 if (old_child) { | 496 if (old_child) { |
497 // TODO(jhorwich): Allow multiple popup_child_host_view_ per view, or | 497 // TODO(jhorwich): Allow multiple popup_child_host_view_ per view, or |
498 // similar mechanism to ensure a second popup doesn't cause the first one | 498 // similar mechanism to ensure a second popup doesn't cause the first one |
499 // to never get a chance to filter events. See crbug.com/160589. | 499 // to never get a chance to filter events. See crbug.com/160589. |
500 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); | 500 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); |
501 if (transient_window_client) { | 501 if (transient_window_client) { |
502 transient_window_client->RemoveTransientChild( | 502 transient_window_client->RemoveTransientChild( |
503 popup_parent_host_view_->window_, old_child->window_); | 503 popup_parent_host_view_->window_, old_child->window_); |
504 } | 504 } |
505 old_child->popup_parent_host_view_ = NULL; | 505 old_child->popup_parent_host_view_ = NULL; |
506 } | 506 } |
507 popup_parent_host_view_->popup_child_host_view_ = this; | 507 popup_parent_host_view_->popup_child_host_view_ = this; |
508 window_->SetType(ui::wm::WINDOW_TYPE_MENU); | 508 window_->SetType(ui::wm::WINDOW_TYPE_MENU); |
509 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 509 window_->Init(ui::LAYER_SOLID_COLOR); |
510 window_->SetName("RenderWidgetHostViewAura"); | 510 window_->SetName("RenderWidgetHostViewAura"); |
511 window_->layer()->SetColor(background_color_); | 511 window_->layer()->SetColor(background_color_); |
512 | 512 |
513 // Setting the transient child allows for the popup to get mouse events when | 513 // Setting the transient child allows for the popup to get mouse events when |
514 // in a system modal dialog. Do this before calling ParentWindowWithContext | 514 // in a system modal dialog. Do this before calling ParentWindowWithContext |
515 // below so that the transient parent is visible to WindowTreeClient. | 515 // below so that the transient parent is visible to WindowTreeClient. |
516 // This fixes crbug.com/328593. | 516 // This fixes crbug.com/328593. |
517 if (transient_window_client) { | 517 if (transient_window_client) { |
518 transient_window_client->AddTransientChild( | 518 transient_window_client->AddTransientChild( |
519 popup_parent_host_view_->window_, window_); | 519 popup_parent_host_view_->window_, window_); |
520 } | 520 } |
521 | 521 |
522 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); | 522 aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); |
523 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); | 523 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); |
524 | 524 |
525 SetBounds(bounds_in_screen); | 525 SetBounds(bounds_in_screen); |
526 Show(); | 526 Show(); |
527 if (NeedsMouseCapture()) | 527 if (NeedsMouseCapture()) |
528 window_->SetCapture(); | 528 window_->SetCapture(); |
529 | 529 |
530 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); | 530 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); |
531 } | 531 } |
532 | 532 |
533 void RenderWidgetHostViewAura::InitAsFullscreen( | 533 void RenderWidgetHostViewAura::InitAsFullscreen( |
534 RenderWidgetHostView* reference_host_view) { | 534 RenderWidgetHostView* reference_host_view) { |
535 is_fullscreen_ = true; | 535 is_fullscreen_ = true; |
536 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 536 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
537 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); | 537 window_->Init(ui::LAYER_SOLID_COLOR); |
538 window_->SetName("RenderWidgetHostViewAura"); | 538 window_->SetName("RenderWidgetHostViewAura"); |
539 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 539 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
540 window_->layer()->SetColor(background_color_); | 540 window_->layer()->SetColor(background_color_); |
541 | 541 |
542 aura::Window* parent = NULL; | 542 aura::Window* parent = NULL; |
543 gfx::Rect bounds; | 543 gfx::Rect bounds; |
544 if (reference_host_view) { | 544 if (reference_host_view) { |
545 aura::Window* reference_window = | 545 aura::Window* reference_window = |
546 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 546 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
547 if (reference_window) { | 547 if (reference_window) { |
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 | 2677 |
2678 //////////////////////////////////////////////////////////////////////////////// | 2678 //////////////////////////////////////////////////////////////////////////////// |
2679 // RenderWidgetHostViewBase, public: | 2679 // RenderWidgetHostViewBase, public: |
2680 | 2680 |
2681 // static | 2681 // static |
2682 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2682 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2683 GetScreenInfoForWindow(results, NULL); | 2683 GetScreenInfoForWindow(results, NULL); |
2684 } | 2684 } |
2685 | 2685 |
2686 } // namespace content | 2686 } // namespace content |
OLD | NEW |