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/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "content/browser/renderer_host/dip_util.h" | 9 #include "content/browser/renderer_host/dip_util.h" |
10 #include "content/browser/renderer_host/overscroll_controller.h" | 10 #include "content/browser/renderer_host/overscroll_controller.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 const gfx::Size& initial_size, gfx::NativeView context) { | 627 const gfx::Size& initial_size, gfx::NativeView context) { |
628 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as | 628 // NOTE: we ignore |initial_size| since in some cases it's wrong (such as |
629 // if the bookmark bar is not shown and you create a new tab). The right | 629 // if the bookmark bar is not shown and you create a new tab). The right |
630 // value is set shortly after this, so its safe to ignore. | 630 // value is set shortly after this, so its safe to ignore. |
631 | 631 |
632 window_.reset(new aura::Window(this)); | 632 window_.reset(new aura::Window(this)); |
633 window_->set_owned_by_parent(false); | 633 window_->set_owned_by_parent(false); |
634 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); | 634 window_->SetType(aura::client::WINDOW_TYPE_CONTROL); |
635 window_->SetTransparent(false); | 635 window_->SetTransparent(false); |
636 window_->Init(ui::LAYER_NOT_DRAWN); | 636 window_->Init(ui::LAYER_NOT_DRAWN); |
637 if (context) { | 637 // TODO(mukai, erg): Should use a non-NULL value later when the DCHECK is |
638 // There are places where there is no context currently because object | 638 // turned on in SetDefaultParentByRootWindow(). |
639 // hierarchies are built before they're attached to a Widget. (See | 639 aura::RootWindow* target_root = context ? context->GetRootWindow() : NULL; |
640 // views::WebView as an example; GetWidget() returns NULL at the point | 640 window_->SetDefaultParentByRootWindow(target_root, gfx::Rect()); |
641 // where we are created.) | |
642 // | |
643 // It should be OK to not set a default parent since such users will | |
644 // explicitly add this WebContentsViewAura to their tree after they create | |
645 // us. | |
646 window_->SetDefaultParentByRootWindow(context->GetRootWindow(), | |
647 gfx::Rect()); | |
648 } | |
649 window_->layer()->SetMasksToBounds(true); | 641 window_->layer()->SetMasksToBounds(true); |
650 window_->SetName("WebContentsViewAura"); | 642 window_->SetName("WebContentsViewAura"); |
651 | 643 |
652 window_observer_.reset(new WindowObserver(this)); | 644 window_observer_.reset(new WindowObserver(this)); |
653 | 645 |
654 // delegate_->GetDragDestDelegate() creates a new delegate on every call. | 646 // delegate_->GetDragDestDelegate() creates a new delegate on every call. |
655 // Hence, we save a reference to it locally. Similar model is used on other | 647 // Hence, we save a reference to it locally. Similar model is used on other |
656 // platforms as well. | 648 // platforms as well. |
657 if (delegate_.get()) | 649 if (delegate_.get()) |
658 drag_dest_delegate_ = delegate_->GetDragDestDelegate(); | 650 drag_dest_delegate_ = delegate_->GetDragDestDelegate(); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 event.location(), | 1110 event.location(), |
1119 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1111 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1120 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1112 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1121 if (drag_dest_delegate_) | 1113 if (drag_dest_delegate_) |
1122 drag_dest_delegate_->OnDrop(); | 1114 drag_dest_delegate_->OnDrop(); |
1123 current_drop_data_.reset(); | 1115 current_drop_data_.reset(); |
1124 return current_drag_op_; | 1116 return current_drag_op_; |
1125 } | 1117 } |
1126 | 1118 |
1127 } // namespace content | 1119 } // namespace content |
OLD | NEW |