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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "skia/ext/image_operations.h" | 46 #include "skia/ext/image_operations.h" |
47 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 47 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
48 #include "third_party/WebKit/public/web/WebInputEvent.h" | 48 #include "third_party/WebKit/public/web/WebInputEvent.h" |
49 #include "third_party/WebKit/public/web/WebScreenInfo.h" | 49 #include "third_party/WebKit/public/web/WebScreenInfo.h" |
50 #include "ui/aura/client/activation_client.h" | 50 #include "ui/aura/client/activation_client.h" |
51 #include "ui/aura/client/aura_constants.h" | 51 #include "ui/aura/client/aura_constants.h" |
52 #include "ui/aura/client/cursor_client.h" | 52 #include "ui/aura/client/cursor_client.h" |
53 #include "ui/aura/client/cursor_client_observer.h" | 53 #include "ui/aura/client/cursor_client_observer.h" |
54 #include "ui/aura/client/focus_client.h" | 54 #include "ui/aura/client/focus_client.h" |
55 #include "ui/aura/client/screen_position_client.h" | 55 #include "ui/aura/client/screen_position_client.h" |
56 #include "ui/aura/client/stacking_client.h" | |
57 #include "ui/aura/client/tooltip_client.h" | 56 #include "ui/aura/client/tooltip_client.h" |
| 57 #include "ui/aura/client/window_tree_client.h" |
58 #include "ui/aura/client/window_types.h" | 58 #include "ui/aura/client/window_types.h" |
59 #include "ui/aura/env.h" | 59 #include "ui/aura/env.h" |
60 #include "ui/aura/root_window.h" | 60 #include "ui/aura/root_window.h" |
61 #include "ui/aura/window.h" | 61 #include "ui/aura/window.h" |
62 #include "ui/aura/window_observer.h" | 62 #include "ui/aura/window_observer.h" |
63 #include "ui/aura/window_tracker.h" | 63 #include "ui/aura/window_tracker.h" |
64 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 64 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
65 #include "ui/base/hit_test.h" | 65 #include "ui/base/hit_test.h" |
66 #include "ui/base/ime/input_method.h" | 66 #include "ui/base/ime/input_method.h" |
67 #include "ui/base/ui_base_types.h" | 67 #include "ui/base/ui_base_types.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // to never get a chance to filter events. See crbug.com/160589. | 639 // to never get a chance to filter events. See crbug.com/160589. |
640 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); | 640 DCHECK(old_child->popup_parent_host_view_ == popup_parent_host_view_); |
641 old_child->popup_parent_host_view_ = NULL; | 641 old_child->popup_parent_host_view_ = NULL; |
642 } | 642 } |
643 popup_parent_host_view_->popup_child_host_view_ = this; | 643 popup_parent_host_view_->popup_child_host_view_ = this; |
644 window_->SetType(aura::client::WINDOW_TYPE_MENU); | 644 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
645 window_->Init(ui::LAYER_TEXTURED); | 645 window_->Init(ui::LAYER_TEXTURED); |
646 window_->SetName("RenderWidgetHostViewAura"); | 646 window_->SetName("RenderWidgetHostViewAura"); |
647 | 647 |
648 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); | 648 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); |
649 window_->SetDefaultParentByRootWindow(root, bounds_in_screen); | 649 aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); |
650 | 650 |
651 // TODO(erg): While I could make sure details of the StackingClient are | 651 // TODO(erg): While I could make sure details of the WindowTreeClient are |
652 // hidden behind aura, hiding the details of the ScreenPositionClient will | 652 // hidden behind aura, hiding the details of the ScreenPositionClient will |
653 // take another effort. | 653 // take another effort. |
654 aura::client::ScreenPositionClient* screen_position_client = | 654 aura::client::ScreenPositionClient* screen_position_client = |
655 aura::client::GetScreenPositionClient(root); | 655 aura::client::GetScreenPositionClient(root); |
656 gfx::Point origin_in_parent(bounds_in_screen.origin()); | 656 gfx::Point origin_in_parent(bounds_in_screen.origin()); |
657 if (screen_position_client) { | 657 if (screen_position_client) { |
658 screen_position_client->ConvertPointFromScreen( | 658 screen_position_client->ConvertPointFromScreen( |
659 window_->parent(), &origin_in_parent); | 659 window_->parent(), &origin_in_parent); |
660 } | 660 } |
661 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size())); | 661 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size())); |
(...skipping 15 matching lines...) Expand all Loading... |
677 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; | 677 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; |
678 if (reference_window) { | 678 if (reference_window) { |
679 host_tracker_.reset(new aura::WindowTracker); | 679 host_tracker_.reset(new aura::WindowTracker); |
680 host_tracker_->Add(reference_window); | 680 host_tracker_->Add(reference_window); |
681 } | 681 } |
682 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 682 gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
683 GetDisplayNearestWindow(reference_window); | 683 GetDisplayNearestWindow(reference_window); |
684 parent = reference_window->GetRootWindow(); | 684 parent = reference_window->GetRootWindow(); |
685 bounds = display.bounds(); | 685 bounds = display.bounds(); |
686 } | 686 } |
687 window_->SetDefaultParentByRootWindow(parent, bounds); | 687 aura::client::ParentWindowWithContext(window_, parent, bounds); |
688 Show(); | 688 Show(); |
689 Focus(); | 689 Focus(); |
690 } | 690 } |
691 | 691 |
692 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 692 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
693 return host_; | 693 return host_; |
694 } | 694 } |
695 | 695 |
696 void RenderWidgetHostViewAura::WasShown() { | 696 void RenderWidgetHostViewAura::WasShown() { |
697 DCHECK(host_); | 697 DCHECK(host_); |
(...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 RenderWidgetHost* widget) { | 3444 RenderWidgetHost* widget) { |
3445 return new RenderWidgetHostViewAura(widget); | 3445 return new RenderWidgetHostViewAura(widget); |
3446 } | 3446 } |
3447 | 3447 |
3448 // static | 3448 // static |
3449 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3449 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3450 GetScreenInfoForWindow(results, NULL); | 3450 GetScreenInfoForWindow(results, NULL); |
3451 } | 3451 } |
3452 | 3452 |
3453 } // namespace content | 3453 } // namespace content |
OLD | NEW |