Reland: Aura: Fix crash on dragging URL into tab strip

The widget for the window containing the drop-location arrow needs a parent
under Aura to be placed correctly. A parent or context for each widget is
required due to https://codereview.chromium.org/11829040/

BUG=173229
TEST=Open two tabs, verify you can drag a blue URL link into the space between the two tabs in the tab strip. The URL should open in a new tab and Chrome should not crash.
TBR=sky@chromium.org

Original commit: https://src.chromium.org/viewvc/chrome?view=rev&revision=180006

Review URL: https://codereview.chromium.org/12096103

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180151 0039d316-1c4b-4281-b951-d872f2087c98
parent 54e0ee69
...@@ -2276,7 +2276,8 @@ void TabStrip::SetDropIndex(int tab_data_index, bool drop_before) { ...@@ -2276,7 +2276,8 @@ void TabStrip::SetDropIndex(int tab_data_index, bool drop_before) {
&is_beneath); &is_beneath);
if (!drop_info_.get()) { if (!drop_info_.get()) {
drop_info_.reset(new DropInfo(tab_data_index, drop_before, !is_beneath)); drop_info_.reset(
new DropInfo(tab_data_index, drop_before, !is_beneath, GetWidget()));
} else { } else {
drop_info_->drop_index = tab_data_index; drop_info_->drop_index = tab_data_index;
drop_info_->drop_before = drop_before; drop_info_->drop_before = drop_before;
...@@ -2310,7 +2311,10 @@ gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) { ...@@ -2310,7 +2311,10 @@ gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) {
// TabStrip::DropInfo ---------------------------------------------------------- // TabStrip::DropInfo ----------------------------------------------------------
TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) TabStrip::DropInfo::DropInfo(int drop_index,
bool drop_before,
bool point_down,
views::Widget* context)
: drop_index(drop_index), : drop_index(drop_index),
drop_before(drop_before), drop_before(drop_before),
point_down(point_down) { point_down(point_down) {
...@@ -2324,6 +2328,7 @@ TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) ...@@ -2324,6 +2328,7 @@ TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down)
params.accept_events = false; params.accept_events = false;
params.can_activate = false; params.can_activate = false;
params.bounds = gfx::Rect(drop_indicator_width, drop_indicator_height); params.bounds = gfx::Rect(drop_indicator_width, drop_indicator_height);
params.context = context->GetNativeView();
arrow_window->Init(params); arrow_window->Init(params);
arrow_window->SetContentsView(arrow_view); arrow_window->SetContentsView(arrow_view);
} }
......
...@@ -256,7 +256,10 @@ class TabStrip : public views::View, ...@@ -256,7 +256,10 @@ class TabStrip : public views::View,
// Used during a drop session of a url. Tracks the position of the drop as // Used during a drop session of a url. Tracks the position of the drop as
// well as a window used to highlight where the drop occurs. // well as a window used to highlight where the drop occurs.
struct DropInfo { struct DropInfo {
DropInfo(int index, bool drop_before, bool paint_down); DropInfo(int drop_index,
bool drop_before,
bool point_down,
views::Widget* context);
~DropInfo(); ~DropInfo();
// Index of the tab to drop on. If drop_before is true, the drop should // Index of the tab to drop on. If drop_before is true, the drop should
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment