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

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

Issue 6750007: Scrolling Tabs (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: addressing reviewer issues Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base_tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/ui/title_prefix_matcher.h" 8 #include "chrome/browser/ui/title_prefix_matcher.h"
9 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" 10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return false; 371 return false;
372 bool started_drag = drag_controller_->started_drag(); 372 bool started_drag = drag_controller_->started_drag();
373 drag_controller_->EndDrag(canceled); 373 drag_controller_->EndDrag(canceled);
374 return started_drag; 374 return started_drag;
375 } 375 }
376 376
377 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, 377 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab,
378 const gfx::Point& tab_in_tab_coordinates) { 378 const gfx::Point& tab_in_tab_coordinates) {
379 gfx::Point local_point = tab_in_tab_coordinates; 379 gfx::Point local_point = tab_in_tab_coordinates;
380 ConvertPointToView(tab, this, &local_point); 380 ConvertPointToView(tab, this, &local_point);
381 return GetTabAtLocal(local_point);
382 }
383
384 BaseTab* BaseTabStrip::GetTabAtLocal(
385 const gfx::Point& local_point) {
381 views::View* view = GetEventHandlerForPoint(local_point); 386 views::View* view = GetEventHandlerForPoint(local_point);
382 if (!view) 387 if (!view)
383 return NULL; // No tab contains the point. 388 return NULL; // No tab contains the point.
384 389
385 // Walk up the view hierarchy until we find a tab, or the TabStrip. 390 // Walk up the view hierarchy until we find a tab, or the TabStrip.
386 while (view && view != this && view->GetID() != VIEW_ID_TAB) 391 while (view && view != this && view->GetID() != VIEW_ID_TAB)
387 view = view->parent(); 392 view = view->parent();
388 393
389 return view && view->GetID() == VIEW_ID_TAB ? 394 return view && view->GetID() == VIEW_ID_TAB ?
390 static_cast<BaseTab*>(view) : NULL; 395 static_cast<BaseTab*>(view) : NULL;
391 } 396 }
392 397
rjkroege 2011/03/28 22:07:40 remove
wyck 2011/03/30 15:53:11 Done.
398
393 void BaseTabStrip::Layout() { 399 void BaseTabStrip::Layout() {
394 // Only do a layout if our size changed. 400 // Only do a layout if our size changed.
395 if (last_layout_size_ == size()) 401 if (last_layout_size_ == size())
396 return; 402 return;
397 DoLayout(); 403 DoLayout();
398 } 404 }
399 405
400 bool BaseTabStrip::GetDropFormats( 406 bool BaseTabStrip::GetDropFormats(
401 int* formats, 407 int* formats,
402 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { 408 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // Animate the view back to its correct position. 600 // Animate the view back to its correct position.
595 GenerateIdealBounds(); 601 GenerateIdealBounds();
596 AnimateToIdealBounds(); 602 AnimateToIdealBounds();
597 } 603 }
598 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); 604 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab)));
599 // Install a delegate to reset the dragging state when done. We have to leave 605 // Install a delegate to reset the dragging state when done. We have to leave
600 // dragging true for the tab otherwise it'll draw beneath the new tab button. 606 // dragging true for the tab otherwise it'll draw beneath the new tab button.
601 bounds_animator_.SetAnimationDelegate( 607 bounds_animator_.SetAnimationDelegate(
602 tab, new ResetDraggingStateDelegate(tab), true); 608 tab, new ResetDraggingStateDelegate(tab), true);
603 } 609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698