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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 RenderWidgetHostViewAura* old_child = | 335 RenderWidgetHostViewAura* old_child = |
336 popup_parent_host_view_->popup_child_host_view_; | 336 popup_parent_host_view_->popup_child_host_view_; |
337 if (old_child) { | 337 if (old_child) { |
338 // TODO(jhorwich): Allow multiple popup_child_host_view_ per view, or | 338 // TODO(jhorwich): Allow multiple popup_child_host_view_ per view, or |
339 // similar mechanism to ensure a second popup doesn't cause the first one | 339 // similar mechanism to ensure a second popup doesn't cause the first one |
340 // to never get a chance to filter events. See crbug.com/160589. | 340 // to never get a chance to filter events. See crbug.com/160589. |
341 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); | 341 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); |
342 old_child->popup_parent_host_view_ = NULL; | 342 old_child->popup_parent_host_view_ = NULL; |
343 } | 343 } |
344 popup_parent_host_view_->popup_child_host_view_ = this; | 344 popup_parent_host_view_->popup_child_host_view_ = this; |
345 if (popup_type_ != WebKit::WebPopupTypeNone) | |
346 window_->SetCapture(); | |
347 window_->SetType(aura::client::WINDOW_TYPE_MENU); | 345 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
348 window_->Init(ui::LAYER_TEXTURED); | 346 window_->Init(ui::LAYER_TEXTURED); |
349 window_->SetName("RenderWidgetHostViewAura"); | 347 window_->SetName("RenderWidgetHostViewAura"); |
350 | 348 |
351 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); | 349 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); |
352 window_->SetDefaultParentByRootWindow(root, bounds_in_screen); | 350 window_->SetDefaultParentByRootWindow(root, bounds_in_screen); |
353 | 351 |
354 // TODO(erg): While I could make sure details of the StackingClient are | 352 // TODO(erg): While I could make sure details of the StackingClient are |
355 // hidden behind aura, hiding the details of the ScreenPositionClient will | 353 // hidden behind aura, hiding the details of the ScreenPositionClient will |
356 // take another effort. | 354 // take another effort. |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 } | 1542 } |
1545 | 1543 |
1546 switch (event->type()) { | 1544 switch (event->type()) { |
1547 case ui::ET_MOUSE_PRESSED: | 1545 case ui::ET_MOUSE_PRESSED: |
1548 window_->SetCapture(); | 1546 window_->SetCapture(); |
1549 // Confirm existing composition text on mouse click events, to make sure | 1547 // Confirm existing composition text on mouse click events, to make sure |
1550 // the input caret won't be moved with an ongoing composition text. | 1548 // the input caret won't be moved with an ongoing composition text. |
1551 FinishImeCompositionSession(); | 1549 FinishImeCompositionSession(); |
1552 break; | 1550 break; |
1553 case ui::ET_MOUSE_RELEASED: | 1551 case ui::ET_MOUSE_RELEASED: |
1554 if (popup_type_ == WebKit::WebPopupTypeNone && | 1552 window_->ReleaseCapture(); |
1555 (popup_child_host_view_ == NULL || | |
1556 popup_child_host_view_->popup_type_ == WebKit::WebPopupTypeNone)) | |
1557 window_->ReleaseCapture(); | |
1558 break; | 1553 break; |
1559 default: | 1554 default: |
1560 break; | 1555 break; |
1561 } | 1556 } |
1562 | 1557 |
1563 // Needed to propagate mouse event to native_tab_contents_view_aura. | 1558 // Needed to propagate mouse event to native_tab_contents_view_aura. |
1564 // TODO(pkotwicz): Find a better way of doing this. | 1559 // TODO(pkotwicz): Find a better way of doing this. |
1565 if (window_->parent()->delegate() && !(event->flags() & ui::EF_FROM_TOUCH)) | 1560 if (window_->parent()->delegate() && !(event->flags() & ui::EF_FROM_TOUCH)) |
1566 window_->parent()->delegate()->OnMouseEvent(event); | 1561 window_->parent()->delegate()->OnMouseEvent(event); |
1567 | 1562 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 RenderWidgetHost* widget) { | 1973 RenderWidgetHost* widget) { |
1979 return new RenderWidgetHostViewAura(widget); | 1974 return new RenderWidgetHostViewAura(widget); |
1980 } | 1975 } |
1981 | 1976 |
1982 // static | 1977 // static |
1983 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1978 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1984 GetScreenInfoForWindow(results, NULL); | 1979 GetScreenInfoForWindow(results, NULL); |
1985 } | 1980 } |
1986 | 1981 |
1987 } // namespace content | 1982 } // namespace content |
OLD | NEW |