| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tabs/tab.h" | 5 #include "chrome/browser/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
| 8 #include "chrome/common/gfx/chrome_canvas.h" | 8 #include "chrome/common/gfx/chrome_canvas.h" |
| 9 #include "chrome/common/gfx/path.h" | 9 #include "chrome/common/gfx/path.h" |
| 10 #include "chrome/common/l10n_util.h" | 10 #include "chrome/common/l10n_util.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 bool Tab::OnMouseDragged(const views::MouseEvent& event) { | 150 bool Tab::OnMouseDragged(const views::MouseEvent& event) { |
| 151 delegate_->ContinueDrag(event); | 151 delegate_->ContinueDrag(event); |
| 152 return true; | 152 return true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) { | 155 void Tab::OnMouseReleased(const views::MouseEvent& event, bool canceled) { |
| 156 // Notify the drag helper that we're done with any potential drag operations. | 156 // Notify the drag helper that we're done with any potential drag operations. |
| 157 // Clean up the drag helper, which is re-created on the next mouse press. | 157 // Clean up the drag helper, which is re-created on the next mouse press. |
| 158 delegate_->EndDrag(canceled); | 158 delegate_->EndDrag(canceled); |
| 159 if (event.IsMiddleMouseButton()) | 159 if (event.IsMiddleMouseButton() && HitTest(event.location())) |
| 160 delegate_->CloseTab(this); | 160 delegate_->CloseTab(this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { | 163 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { |
| 164 std::wstring title = GetTitle(); | 164 std::wstring title = GetTitle(); |
| 165 if (!title.empty()) { | 165 if (!title.empty()) { |
| 166 // Only show the tooltip if the title is truncated. | 166 // Only show the tooltip if the title is truncated. |
| 167 ChromeFont font; | 167 ChromeFont font; |
| 168 if (font.GetStringWidth(title) > title_bounds().width()) { | 168 if (font.GetStringWidth(title) > title_bounds().width()) { |
| 169 *tooltip = title; | 169 *tooltip = title; |
| 170 return true; | 170 return true; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // Right end cap. | 233 // Right end cap. |
| 234 path->lineTo(w - kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth); | 234 path->lineTo(w - kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth); |
| 235 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); | 235 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); |
| 236 path->lineTo(w, h); | 236 path->lineTo(w, h); |
| 237 | 237 |
| 238 // Close out the path. | 238 // Close out the path. |
| 239 path->lineTo(0, h); | 239 path->lineTo(0, h); |
| 240 path->close(); | 240 path->close(); |
| 241 } | 241 } |
| OLD | NEW |