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

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

Issue 10827271: Replace views::Event with ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/task_manager_view.cc » ('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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 // ideal bounds and we need to know ideal bounds is in a good state. 730 // ideal bounds and we need to know ideal bounds is in a good state.
731 StopAnimating(true); 731 StopAnimating(true);
732 } 732 }
733 733
734 if (!GetWidget()) 734 if (!GetWidget())
735 return; 735 return;
736 736
737 // If the user closes the tab from a touch device don't wait for the mouse to 737 // If the user closes the tab from a touch device don't wait for the mouse to
738 // move out of the tab strip (it may never happen). 738 // move out of the tab strip (it may never happen).
739 // TODO: maybe we should use a delay on touch devices. 739 // TODO: maybe we should use a delay on touch devices.
740 const views::Event* event = GetWidget()->GetCurrentEvent(); 740 const ui::Event* event = GetWidget()->GetCurrentEvent();
741 if (event && event->type() == ui::ET_MOUSE_RELEASED && 741 if (event && event->type() == ui::ET_MOUSE_RELEASED &&
742 event->flags() & ui::EF_FROM_TOUCH) 742 event->flags() & ui::EF_FROM_TOUCH)
743 return; 743 return;
744 744
745 int model_count = GetModelCount(); 745 int model_count = GetModelCount();
746 if (model_index + 1 != model_count && model_count > 1) { 746 if (model_index + 1 != model_count && model_count > 1) {
747 // The user is about to close a tab other than the last tab. Set 747 // The user is about to close a tab other than the last tab. Set
748 // available_width_for_tabs_ so that if we do a layout we don't position a 748 // available_width_for_tabs_ so that if we do a layout we don't position a
749 // tab past the end of the second to last tab. We do this so that as the 749 // tab past the end of the second to last tab. We do this so that as the
750 // user closes tabs with the mouse a tab continues to fall under the mouse. 750 // user closes tabs with the mouse a tab continues to fall under the mouse.
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 int TabStrip::GetMiniTabCount() const { 1346 int TabStrip::GetMiniTabCount() const {
1347 int mini_count = 0; 1347 int mini_count = 0;
1348 while (mini_count < tab_count() && tab_at(mini_count)->data().mini) 1348 while (mini_count < tab_count() && tab_at(mini_count)->data().mini)
1349 mini_count++; 1349 mini_count++;
1350 return mini_count; 1350 return mini_count;
1351 } 1351 }
1352 1352
1353 /////////////////////////////////////////////////////////////////////////////// 1353 ///////////////////////////////////////////////////////////////////////////////
1354 // TabStrip, views::ButtonListener implementation: 1354 // TabStrip, views::ButtonListener implementation:
1355 1355
1356 void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) { 1356 void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) {
1357 if (sender == newtab_button_) { 1357 if (sender == newtab_button_) {
1358 content::RecordAction(UserMetricsAction("NewTab_Button")); 1358 content::RecordAction(UserMetricsAction("NewTab_Button"));
1359 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON, 1359 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON,
1360 TabStripModel::NEW_TAB_ENUM_COUNT); 1360 TabStripModel::NEW_TAB_ENUM_COUNT);
1361 controller()->CreateNewTab(); 1361 controller()->CreateNewTab();
1362 } 1362 }
1363 } 1363 }
1364 1364
1365 /////////////////////////////////////////////////////////////////////////////// 1365 ///////////////////////////////////////////////////////////////////////////////
1366 // TabStrip, protected: 1366 // TabStrip, protected:
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 2360
2361 int mini_tab_count = GetMiniTabCount(); 2361 int mini_tab_count = GetMiniTabCount();
2362 int normal_count = tab_count() - mini_tab_count; 2362 int normal_count = tab_count() - mini_tab_count;
2363 if (normal_count <= 1 || normal_count == mini_tab_count) 2363 if (normal_count <= 1 || normal_count == mini_tab_count)
2364 return false; 2364 return false;
2365 int x = GetStartXForNormalTabs(); 2365 int x = GetStartXForNormalTabs();
2366 int available_width = width() - x - new_tab_button_width(); 2366 int available_width = width() - x - new_tab_button_width();
2367 return (Tab::GetTouchWidth() * normal_count + 2367 return (Tab::GetTouchWidth() * normal_count +
2368 tab_h_offset() * (normal_count - 1)) > available_width; 2368 tab_h_offset() * (normal_count - 1)) > available_width;
2369 } 2369 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | chrome/browser/ui/views/task_manager_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698