| 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 "app/gfx/chrome_canvas.h" | 7 #include "app/gfx/chrome_canvas.h" |
| 8 #include "app/gfx/path.h" | 8 #include "app/gfx/path.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // (normal windows behavior is to discard presses of a UI element where the | 192 // (normal windows behavior is to discard presses of a UI element where the |
| 193 // releases happen off the element). | 193 // releases happen off the element). |
| 194 if (event.IsMiddleMouseButton() && HitTest(event.location())) | 194 if (event.IsMiddleMouseButton() && HitTest(event.location())) |
| 195 delegate_->CloseTab(this); | 195 delegate_->CloseTab(this); |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { | 198 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { |
| 199 std::wstring title = GetTitle(); | 199 std::wstring title = GetTitle(); |
| 200 if (!title.empty()) { | 200 if (!title.empty()) { |
| 201 // Only show the tooltip if the title is truncated. | 201 // Only show the tooltip if the title is truncated. |
| 202 ChromeFont font; | 202 gfx::Font font; |
| 203 if (font.GetStringWidth(title) > title_bounds().width()) { | 203 if (font.GetStringWidth(title) > title_bounds().width()) { |
| 204 *tooltip = title; | 204 *tooltip = title; |
| 205 return true; | 205 return true; |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 return false; | 208 return false; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool Tab::GetTooltipTextOrigin(int x, int y, gfx::Point* origin) { | 211 bool Tab::GetTooltipTextOrigin(int x, int y, gfx::Point* origin) { |
| 212 ChromeFont font; | 212 gfx::Font font; |
| 213 origin->set_x(title_bounds().x() + 10); | 213 origin->set_x(title_bounds().x() + 10); |
| 214 origin->set_y(-views::TooltipManager::GetTooltipHeight() - 4); | 214 origin->set_y(-views::TooltipManager::GetTooltipHeight() - 4); |
| 215 return true; | 215 return true; |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool Tab::GetAccessibleRole(AccessibilityTypes::Role* role) { | 218 bool Tab::GetAccessibleRole(AccessibilityTypes::Role* role) { |
| 219 DCHECK(role); | 219 DCHECK(role); |
| 220 | 220 |
| 221 *role = AccessibilityTypes::ROLE_PAGETAB; | 221 *role = AccessibilityTypes::ROLE_PAGETAB; |
| 222 return true; | 222 return true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 // Close out the path. | 274 // Close out the path. |
| 275 path->lineTo(0, h); | 275 path->lineTo(0, h); |
| 276 path->close(); | 276 path->close(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void Tab::ContextMenuClosed() { | 279 void Tab::ContextMenuClosed() { |
| 280 delegate()->StopAllHighlighting(); | 280 delegate()->StopAllHighlighting(); |
| 281 menu_controller_ = NULL; | 281 menu_controller_ = NULL; |
| 282 } | 282 } |
| OLD | NEW |