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

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

Issue 403963002: Remove remaining overrides of View::GetEventHandlerForRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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') | ui/message_center/views/notification_view.h » ('j') | 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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) {
1416 if (!views::UsePointBasedTargeting(rect))
1417 return View::GetEventHandlerForRect(rect);
1418 const gfx::Point point(rect.CenterPoint());
1419
1420 if (!touch_layout_) {
1421 // Return any view that isn't a Tab or this TabStrip immediately. We don't
1422 // want to interfere.
1423 views::View* v = View::GetEventHandlerForRect(rect);
1424 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName))
1425 return v;
1426
1427 views::View* tab = FindTabHitByPoint(point);
1428 if (tab)
1429 return tab;
1430 } else {
1431 if (newtab_button_->visible()) {
1432 views::View* view =
1433 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
1434 if (view)
1435 return view;
1436 }
1437 Tab* tab = FindTabForEvent(point);
1438 if (tab)
1439 return ConvertPointToViewAndGetEventHandler(this, tab, point);
1440 }
1441 return this;
1442 }
1443
1444 views::View* TabStrip::GetTooltipHandlerForPoint(const gfx::Point& point) { 1418 views::View* TabStrip::GetTooltipHandlerForPoint(const gfx::Point& point) {
1445 if (!HitTestPoint(point)) 1419 if (!HitTestPoint(point))
1446 return NULL; 1420 return NULL;
1447 1421
1448 if (!touch_layout_) { 1422 if (!touch_layout_) {
1449 // Return any view that isn't a Tab or this TabStrip immediately. We don't 1423 // Return any view that isn't a Tab or this TabStrip immediately. We don't
1450 // want to interfere. 1424 // want to interfere.
1451 views::View* v = View::GetTooltipHandlerForPoint(point); 1425 views::View* v = View::GetTooltipHandlerForPoint(point);
1452 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName)) 1426 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName))
1453 return v; 1427 return v;
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 action = TouchUMA::GESTURE_TABSWITCH_TAP; 2687 action = TouchUMA::GESTURE_TABSWITCH_TAP;
2714 TouchUMA::RecordGestureAction(action); 2688 TouchUMA::RecordGestureAction(action);
2715 break; 2689 break;
2716 } 2690 }
2717 2691
2718 default: 2692 default:
2719 break; 2693 break;
2720 } 2694 }
2721 event->SetHandled(); 2695 event->SetHandled();
2722 } 2696 }
2697
2698 views::View* TabStrip::TargetForRect(views::View* root, const gfx::Rect& rect) {
2699 CHECK_EQ(root, this);
2700
2701 if (!views::UsePointBasedTargeting(rect))
2702 return views::ViewTargeterDelegate::TargetForRect(root, rect);
2703 const gfx::Point point(rect.CenterPoint());
2704
2705 if (!touch_layout_) {
2706 // Return any view that isn't a Tab or this TabStrip immediately. We don't
2707 // want to interfere.
2708 views::View* v = views::ViewTargeterDelegate::TargetForRect(root, rect);
2709 if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName))
2710 return v;
2711
2712 views::View* tab = FindTabHitByPoint(point);
2713 if (tab)
2714 return tab;
2715 } else {
2716 if (newtab_button_->visible()) {
2717 views::View* view =
2718 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
2719 if (view)
2720 return view;
2721 }
2722 Tab* tab = FindTabForEvent(point);
2723 if (tab)
2724 return ConvertPointToViewAndGetEventHandler(this, tab, point);
2725 }
2726 return this;
2727 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | ui/message_center/views/notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698