| 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 "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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "ui/gfx/path.h" | 45 #include "ui/gfx/path.h" |
| 46 #include "ui/gfx/rect_conversions.h" | 46 #include "ui/gfx/rect_conversions.h" |
| 47 #include "ui/gfx/screen.h" | 47 #include "ui/gfx/screen.h" |
| 48 #include "ui/gfx/size.h" | 48 #include "ui/gfx/size.h" |
| 49 #include "ui/gfx/skia_util.h" | 49 #include "ui/gfx/skia_util.h" |
| 50 #include "ui/views/controls/image_view.h" | 50 #include "ui/views/controls/image_view.h" |
| 51 #include "ui/views/masked_targeter_delegate.h" | 51 #include "ui/views/masked_targeter_delegate.h" |
| 52 #include "ui/views/mouse_watcher_view_host.h" | 52 #include "ui/views/mouse_watcher_view_host.h" |
| 53 #include "ui/views/rect_based_targeting_utils.h" | 53 #include "ui/views/rect_based_targeting_utils.h" |
| 54 #include "ui/views/view_model_utils.h" | 54 #include "ui/views/view_model_utils.h" |
| 55 #include "ui/views/view_targeter.h" |
| 55 #include "ui/views/widget/root_view.h" | 56 #include "ui/views/widget/root_view.h" |
| 56 #include "ui/views/widget/widget.h" | 57 #include "ui/views/widget/widget.h" |
| 57 #include "ui/views/window/non_client_view.h" | 58 #include "ui/views/window/non_client_view.h" |
| 58 | 59 |
| 59 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 60 #include "ui/gfx/win/hwnd_util.h" | 61 #include "ui/gfx/win/hwnd_util.h" |
| 61 #include "ui/views/widget/monitor_win.h" | 62 #include "ui/views/widget/monitor_win.h" |
| 62 #include "ui/views/win/hwnd_util.h" | 63 #include "ui/views/win/hwnd_util.h" |
| 63 #endif | 64 #endif |
| 64 | 65 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 available_width_for_tabs_(-1), | 531 available_width_for_tabs_(-1), |
| 531 in_tab_close_(false), | 532 in_tab_close_(false), |
| 532 animation_container_(new gfx::AnimationContainer()), | 533 animation_container_(new gfx::AnimationContainer()), |
| 533 bounds_animator_(this), | 534 bounds_animator_(this), |
| 534 stacked_layout_(false), | 535 stacked_layout_(false), |
| 535 adjust_layout_(false), | 536 adjust_layout_(false), |
| 536 reset_to_shrink_on_exit_(false), | 537 reset_to_shrink_on_exit_(false), |
| 537 mouse_move_count_(0), | 538 mouse_move_count_(0), |
| 538 immersive_style_(false) { | 539 immersive_style_(false) { |
| 539 Init(); | 540 Init(); |
| 541 SetEventTargeter( |
| 542 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
| 540 } | 543 } |
| 541 | 544 |
| 542 TabStrip::~TabStrip() { | 545 TabStrip::~TabStrip() { |
| 543 FOR_EACH_OBSERVER(TabStripObserver, observers_, | 546 FOR_EACH_OBSERVER(TabStripObserver, observers_, |
| 544 TabStripDeleted(this)); | 547 TabStripDeleted(this)); |
| 545 | 548 |
| 546 // The animations may reference the tabs. Shut down the animation before we | 549 // The animations may reference the tabs. Shut down the animation before we |
| 547 // delete the tabs. | 550 // delete the tabs. |
| 548 StopAnimating(false); | 551 StopAnimating(false); |
| 549 | 552 |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 | 1408 |
| 1406 controller()->PerformDrop(drop_before, drop_index, url); | 1409 controller()->PerformDrop(drop_before, drop_index, url); |
| 1407 | 1410 |
| 1408 return GetDropEffect(event); | 1411 return GetDropEffect(event); |
| 1409 } | 1412 } |
| 1410 | 1413 |
| 1411 void TabStrip::GetAccessibleState(ui::AXViewState* state) { | 1414 void TabStrip::GetAccessibleState(ui::AXViewState* state) { |
| 1412 state->role = ui::AX_ROLE_TAB_LIST; | 1415 state->role = ui::AX_ROLE_TAB_LIST; |
| 1413 } | 1416 } |
| 1414 | 1417 |
| 1415 views::View* TabStrip::GetEventHandlerForRect(const gfx::Rect& rect) { | 1418 views::View* TabStrip::TargetForRect(views::View* root, |
| 1419 const gfx::Rect& rect) { |
| 1420 CHECK_EQ(root, this); |
| 1421 |
| 1416 if (!views::UsePointBasedTargeting(rect)) | 1422 if (!views::UsePointBasedTargeting(rect)) |
| 1417 return View::GetEventHandlerForRect(rect); | 1423 return views::ViewTargeterDelegate::TargetForRect(root, rect); |
| 1418 const gfx::Point point(rect.CenterPoint()); | 1424 const gfx::Point point(rect.CenterPoint()); |
| 1419 | 1425 |
| 1420 if (!touch_layout_) { | 1426 if (!touch_layout_) { |
| 1421 // Return any view that isn't a Tab or this TabStrip immediately. We don't | 1427 // Return any view that isn't a Tab or this TabStrip immediately. We don't |
| 1422 // want to interfere. | 1428 // want to interfere. |
| 1423 views::View* v = View::GetEventHandlerForRect(rect); | 1429 views::View* v = views::ViewTargeterDelegate::TargetForRect(root, rect); |
| 1424 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName)) | 1430 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName)) |
| 1425 return v; | 1431 return v; |
| 1426 | 1432 |
| 1427 views::View* tab = FindTabHitByPoint(point); | 1433 views::View* tab = FindTabHitByPoint(point); |
| 1428 if (tab) | 1434 if (tab) |
| 1429 return tab; | 1435 return tab; |
| 1430 } else { | 1436 } else { |
| 1431 if (newtab_button_->visible()) { | 1437 if (newtab_button_->visible()) { |
| 1432 views::View* view = | 1438 views::View* view = |
| 1433 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 1439 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2713 action = TouchUMA::GESTURE_TABSWITCH_TAP; | 2719 action = TouchUMA::GESTURE_TABSWITCH_TAP; |
| 2714 TouchUMA::RecordGestureAction(action); | 2720 TouchUMA::RecordGestureAction(action); |
| 2715 break; | 2721 break; |
| 2716 } | 2722 } |
| 2717 | 2723 |
| 2718 default: | 2724 default: |
| 2719 break; | 2725 break; |
| 2720 } | 2726 } |
| 2721 event->SetHandled(); | 2727 event->SetHandled(); |
| 2722 } | 2728 } |
| OLD | NEW |