Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 12096103: Reland: Aura: Fix crash on dragging URL into tab strip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/views/tabs/tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/tab_strip.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windowsx.h> 8 #include <windowsx.h>
9 #endif 9 #endif
10 10
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 if (drop_info_.get() && drop_info_->drop_index == tab_data_index && 2269 if (drop_info_.get() && drop_info_->drop_index == tab_data_index &&
2270 drop_info_->drop_before == drop_before) { 2270 drop_info_->drop_before == drop_before) {
2271 return; 2271 return;
2272 } 2272 }
2273 2273
2274 bool is_beneath; 2274 bool is_beneath;
2275 gfx::Rect drop_bounds = GetDropBounds(tab_data_index, drop_before, 2275 gfx::Rect drop_bounds = GetDropBounds(tab_data_index, drop_before,
2276 &is_beneath); 2276 &is_beneath);
2277 2277
2278 if (!drop_info_.get()) { 2278 if (!drop_info_.get()) {
2279 drop_info_.reset(new DropInfo(tab_data_index, drop_before, !is_beneath)); 2279 drop_info_.reset(
2280 new DropInfo(tab_data_index, drop_before, !is_beneath, GetWidget()));
2280 } else { 2281 } else {
2281 drop_info_->drop_index = tab_data_index; 2282 drop_info_->drop_index = tab_data_index;
2282 drop_info_->drop_before = drop_before; 2283 drop_info_->drop_before = drop_before;
2283 if (is_beneath == drop_info_->point_down) { 2284 if (is_beneath == drop_info_->point_down) {
2284 drop_info_->point_down = !is_beneath; 2285 drop_info_->point_down = !is_beneath;
2285 drop_info_->arrow_view->SetImage( 2286 drop_info_->arrow_view->SetImage(
2286 GetDropArrowImage(drop_info_->point_down)); 2287 GetDropArrowImage(drop_info_->point_down));
2287 } 2288 }
2288 } 2289 }
2289 2290
(...skipping 13 matching lines...) Expand all
2303 } 2304 }
2304 2305
2305 // static 2306 // static
2306 gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) { 2307 gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) {
2307 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 2308 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
2308 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP); 2309 is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP);
2309 } 2310 }
2310 2311
2311 // TabStrip::DropInfo ---------------------------------------------------------- 2312 // TabStrip::DropInfo ----------------------------------------------------------
2312 2313
2313 TabStrip::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) 2314 TabStrip::DropInfo::DropInfo(int drop_index,
2315 bool drop_before,
2316 bool point_down,
2317 views::Widget* context)
2314 : drop_index(drop_index), 2318 : drop_index(drop_index),
2315 drop_before(drop_before), 2319 drop_before(drop_before),
2316 point_down(point_down) { 2320 point_down(point_down) {
2317 arrow_view = new views::ImageView; 2321 arrow_view = new views::ImageView;
2318 arrow_view->SetImage(GetDropArrowImage(point_down)); 2322 arrow_view->SetImage(GetDropArrowImage(point_down));
2319 2323
2320 arrow_window = new views::Widget; 2324 arrow_window = new views::Widget;
2321 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 2325 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
2322 params.keep_on_top = true; 2326 params.keep_on_top = true;
2323 params.transparent = true; 2327 params.transparent = true;
2324 params.accept_events = false; 2328 params.accept_events = false;
2325 params.can_activate = false; 2329 params.can_activate = false;
2326 params.bounds = gfx::Rect(drop_indicator_width, drop_indicator_height); 2330 params.bounds = gfx::Rect(drop_indicator_width, drop_indicator_height);
2331 params.context = context->GetNativeView();
2327 arrow_window->Init(params); 2332 arrow_window->Init(params);
2328 arrow_window->SetContentsView(arrow_view); 2333 arrow_window->SetContentsView(arrow_view);
2329 } 2334 }
2330 2335
2331 TabStrip::DropInfo::~DropInfo() { 2336 TabStrip::DropInfo::~DropInfo() {
2332 // Close eventually deletes the window, which deletes arrow_view too. 2337 // Close eventually deletes the window, which deletes arrow_view too.
2333 arrow_window->Close(); 2338 arrow_window->Close();
2334 } 2339 }
2335 2340
2336 /////////////////////////////////////////////////////////////////////////////// 2341 ///////////////////////////////////////////////////////////////////////////////
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 if (!adjust_layout_) 2597 if (!adjust_layout_)
2593 return false; 2598 return false;
2594 2599
2595 #if !defined(OS_CHROMEOS) 2600 #if !defined(OS_CHROMEOS)
2596 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) 2601 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH)
2597 return false; 2602 return false;
2598 #endif 2603 #endif
2599 2604
2600 return true; 2605 return true;
2601 } 2606 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698