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

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

Issue 7057014: Variety of tweaks to View API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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/base_tab_strip.cc ('k') | chrome/browser/ui/views/tabs/tab.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) 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/side_tab_strip.h" 5 #include "chrome/browser/ui/views/tabs/side_tab_strip.h"
6 6
7 #include "chrome/browser/ui/view_ids.h" 7 #include "chrome/browser/ui/view_ids.h"
8 #include "chrome/browser/ui/views/tabs/side_tab.h" 8 #include "chrome/browser/ui/views/tabs/side_tab.h"
9 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" 9 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // SideTabStrip, public: 121 // SideTabStrip, public:
122 122
123 SideTabStrip::SideTabStrip(TabStripController* controller) 123 SideTabStrip::SideTabStrip(TabStripController* controller)
124 : BaseTabStrip(controller, BaseTabStrip::VERTICAL_TAB_STRIP), 124 : BaseTabStrip(controller, BaseTabStrip::VERTICAL_TAB_STRIP),
125 newtab_button_(new SideTabNewTabButton(controller)), 125 newtab_button_(new SideTabNewTabButton(controller)),
126 scroll_up_button_(NULL), 126 scroll_up_button_(NULL),
127 scroll_down_button_(NULL), 127 scroll_down_button_(NULL),
128 separator_(new views::View()), 128 separator_(new views::View()),
129 first_tab_y_offset_(0), 129 first_tab_y_offset_(0),
130 ideal_height_(0) { 130 ideal_height_(0) {
131 SetID(VIEW_ID_TAB_STRIP); 131 set_id(VIEW_ID_TAB_STRIP);
132 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 132 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
133 AddChildView(newtab_button_); 133 AddChildView(newtab_button_);
134 separator_->set_background( 134 separator_->set_background(
135 views::Background::CreateSolidBackground(kSeparatorColor)); 135 views::Background::CreateSolidBackground(kSeparatorColor));
136 AddChildView(separator_); 136 AddChildView(separator_);
137 scroll_up_button_ = new ScrollButton(this, ScrollButton::UP); 137 scroll_up_button_ = new ScrollButton(this, ScrollButton::UP);
138 AddChildView(scroll_up_button_); 138 AddChildView(scroll_up_button_);
139 scroll_down_button_ = new ScrollButton(this, ScrollButton::DOWN); 139 scroll_down_button_ = new ScrollButton(this, ScrollButton::DOWN);
140 AddChildView(scroll_down_button_); 140 AddChildView(scroll_down_button_);
141 } 141 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 canvas->Restore(); 219 canvas->Restore();
220 220
221 scroll_down_button_->Paint(canvas); 221 scroll_down_button_->Paint(canvas);
222 scroll_up_button_->Paint(canvas); 222 scroll_up_button_->Paint(canvas);
223 } 223 }
224 224
225 views::View* SideTabStrip::GetEventHandlerForPoint(const gfx::Point& point) { 225 views::View* SideTabStrip::GetEventHandlerForPoint(const gfx::Point& point) {
226 // Check the scroll buttons first as they visually appear on top of everything 226 // Check the scroll buttons first as they visually appear on top of everything
227 // else. 227 // else.
228 if (scroll_down_button_->IsVisible()) { 228 if (scroll_down_button_->visible()) {
229 gfx::Point local_point(point); 229 gfx::Point local_point(point);
230 View::ConvertPointToView(this, scroll_down_button_, &local_point); 230 View::ConvertPointToView(this, scroll_down_button_, &local_point);
231 if (scroll_down_button_->HitTest(local_point)) 231 if (scroll_down_button_->HitTest(local_point))
232 return scroll_down_button_->GetEventHandlerForPoint(local_point); 232 return scroll_down_button_->GetEventHandlerForPoint(local_point);
233 } 233 }
234 234
235 if (scroll_up_button_->IsVisible()) { 235 if (scroll_up_button_->visible()) {
236 gfx::Point local_point(point); 236 gfx::Point local_point(point);
237 View::ConvertPointToView(this, scroll_up_button_, &local_point); 237 View::ConvertPointToView(this, scroll_up_button_, &local_point);
238 if (scroll_up_button_->HitTest(local_point)) 238 if (scroll_up_button_->HitTest(local_point))
239 return scroll_up_button_->GetEventHandlerForPoint(local_point); 239 return scroll_up_button_->GetEventHandlerForPoint(local_point);
240 } 240 }
241 return views::View::GetEventHandlerForPoint(point); 241 return views::View::GetEventHandlerForPoint(point);
242 } 242 }
243 243
244 void SideTabStrip::ButtonPressed(views::Button* sender, 244 void SideTabStrip::ButtonPressed(views::Button* sender,
245 const views::Event& event) { 245 const views::Event& event) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return; 463 return;
464 464
465 if (ideal_bounds(tab_index).y() < kTabStripInset) { 465 if (ideal_bounds(tab_index).y() < kTabStripInset) {
466 SetFirstTabYOffset(first_tab_y_offset_ - ideal_bounds(tab_index).y() + 466 SetFirstTabYOffset(first_tab_y_offset_ - ideal_bounds(tab_index).y() +
467 kTabStripInset); 467 kTabStripInset);
468 } else if (ideal_bounds(tab_index).bottom() > GetMaxTabY()) { 468 } else if (ideal_bounds(tab_index).bottom() > GetMaxTabY()) {
469 SetFirstTabYOffset(GetMaxTabY() - (ideal_bounds(tab_index).bottom() - 469 SetFirstTabYOffset(GetMaxTabY() - (ideal_bounds(tab_index).bottom() -
470 first_tab_y_offset_)); 470 first_tab_y_offset_));
471 } 471 }
472 } 472 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab_strip.cc ('k') | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698