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