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

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

Issue 10082029: Ash: Fix hit testing for the bottom pixels of tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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') | chrome/browser/ui/views/toolbar_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 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 MAKELPARAM(cursor_point.x, cursor_point.y)); 371 MAKELPARAM(cursor_point.x, cursor_point.y));
372 #else 372 #else
373 NOTIMPLEMENTED(); 373 NOTIMPLEMENTED();
374 #endif 374 #endif
375 } 375 }
376 376
377 /////////////////////////////////////////////////////////////////////////////// 377 ///////////////////////////////////////////////////////////////////////////////
378 // TabStrip, public: 378 // TabStrip, public:
379 379
380 // static 380 // static
381 const char TabStrip::kViewClassName[] = "TabStrip";
382
383 // static
381 const int TabStrip::kMiniToNonMiniGap = 3; 384 const int TabStrip::kMiniToNonMiniGap = 3;
382 385
383 TabStrip::TabStrip(TabStripController* controller) 386 TabStrip::TabStrip(TabStripController* controller)
384 : controller_(controller), 387 : controller_(controller),
385 newtab_button_(NULL), 388 newtab_button_(NULL),
386 current_unselected_width_(Tab::GetStandardSize().width()), 389 current_unselected_width_(Tab::GetStandardSize().width()),
387 current_selected_width_(Tab::GetStandardSize().width()), 390 current_selected_width_(Tab::GetStandardSize().width()),
388 available_width_for_tabs_(-1), 391 available_width_for_tabs_(-1),
389 in_tab_close_(false), 392 in_tab_close_(false),
390 animation_container_(new ui::AnimationContainer()), 393 animation_container_(new ui::AnimationContainer()),
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 if (tabs_closing_map_.find(index) == tabs_closing_map_.end()) 909 if (tabs_closing_map_.find(index) == tabs_closing_map_.end())
907 return; 910 return;
908 911
909 const std::vector<BaseTab*>& tabs = tabs_closing_map_[index]; 912 const std::vector<BaseTab*>& tabs = tabs_closing_map_[index];
910 for (std::vector<BaseTab*>::const_reverse_iterator i = tabs.rbegin(); 913 for (std::vector<BaseTab*>::const_reverse_iterator i = tabs.rbegin();
911 i != tabs.rend(); ++i) { 914 i != tabs.rend(); ++i) {
912 (*i)->Paint(canvas); 915 (*i)->Paint(canvas);
913 } 916 }
914 } 917 }
915 918
919 std::string TabStrip::GetClassName() const {
920 return kViewClassName;
921 }
922
916 gfx::Size TabStrip::GetPreferredSize() { 923 gfx::Size TabStrip::GetPreferredSize() {
917 // Report the minimum width as the size required for a single selected tab 924 // Report the minimum width as the size required for a single selected tab
918 // plus the new tab button. Don't base it on the actual number of tabs because 925 // plus the new tab button. Don't base it on the actual number of tabs because
919 // it's undesirable to have the minimum window size change when a new tab is 926 // it's undesirable to have the minimum window size change when a new tab is
920 // opened. 927 // opened.
921 int needed_width = Tab::GetMinimumSelectedSize().width(); 928 int needed_width = Tab::GetMinimumSelectedSize().width();
922 needed_width += kNewTabButtonHOffset - kTabHOffset; 929 needed_width += kNewTabButtonHOffset - kTabHOffset;
923 needed_width += newtab_button_bounds_.width(); 930 needed_width += newtab_button_bounds_.width();
924 return gfx::Size(needed_width, Tab::GetMinimumUnselectedSize().height()); 931 return gfx::Size(needed_width, Tab::GetMinimumUnselectedSize().height());
925 } 932 }
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 new RemoveTabDelegate(this, tab_closing), 1951 new RemoveTabDelegate(this, tab_closing),
1945 true); 1952 true);
1946 } 1953 }
1947 1954
1948 bool TabStrip::IsPointInTab(Tab* tab, 1955 bool TabStrip::IsPointInTab(Tab* tab,
1949 const gfx::Point& point_in_tabstrip_coords) { 1956 const gfx::Point& point_in_tabstrip_coords) {
1950 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 1957 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
1951 View::ConvertPointToView(this, tab, &point_in_tab_coords); 1958 View::ConvertPointToView(this, tab, &point_in_tab_coords);
1952 return tab->HitTest(point_in_tab_coords); 1959 return tab->HitTest(point_in_tab_coords);
1953 } 1960 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | chrome/browser/ui/views/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698