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

Side by Side Diff: chrome/browser/views/tabs/tab.cc

Issue 12816: Fixed issue where middle click doesn't activiate when not over its tab.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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 | « no previous file | no next file » | 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) 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
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
160 // Close tabs on middle click, but only if the button is released over the tab
161 // (normal windows behavior is to discard presses of a UI element where the
162 // releases happen off the element).
163 if (event.IsMiddleMouseButton() && HitTest(event.location()))
160 delegate_->CloseTab(this); 164 delegate_->CloseTab(this);
161 } 165 }
162 166
163 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) { 167 bool Tab::GetTooltipText(int x, int y, std::wstring* tooltip) {
164 std::wstring title = GetTitle(); 168 std::wstring title = GetTitle();
165 if (!title.empty()) { 169 if (!title.empty()) {
166 // Only show the tooltip if the title is truncated. 170 // Only show the tooltip if the title is truncated.
167 ChromeFont font; 171 ChromeFont font;
168 if (font.GetStringWidth(title) > title_bounds().width()) { 172 if (font.GetStringWidth(title) > title_bounds().width()) {
169 *tooltip = title; 173 *tooltip = title;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 236
233 // Right end cap. 237 // Right end cap.
234 path->lineTo(w - kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth); 238 path->lineTo(w - kTabCapWidth - kTabTopCurveWidth, kTabTopCurveWidth);
235 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); 239 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth);
236 path->lineTo(w, h); 240 path->lineTo(w, h);
237 241
238 // Close out the path. 242 // Close out the path.
239 path->lineTo(0, h); 243 path->lineTo(0, h);
240 path->close(); 244 path->close();
241 } 245 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698