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

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

Issue 28302: Tab close button correctly highlighted on left click (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « 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 <limits> 5 #include <limits>
6 6
7 #include "chrome/browser/views/tabs/tab_renderer.h" 7 #include "chrome/browser/views/tabs/tab_renderer.h"
8 8
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // TabCloseButton 178 // TabCloseButton
179 // 179 //
180 // This is a Button subclass that causes middle clicks to be forwarded to the 180 // This is a Button subclass that causes middle clicks to be forwarded to the
181 // parent View by explicitly not handling them in OnMousePressed. 181 // parent View by explicitly not handling them in OnMousePressed.
182 class TabCloseButton : public views::Button { 182 class TabCloseButton : public views::Button {
183 public: 183 public:
184 TabCloseButton() : Button() {} 184 TabCloseButton() : Button() {}
185 virtual ~TabCloseButton() {} 185 virtual ~TabCloseButton() {}
186 186
187 virtual bool OnMousePressed(const views::MouseEvent& event) { 187 virtual bool OnMousePressed(const views::MouseEvent& event) {
188 LOG(WARNING) << "MOUSE PRESSED"; 188 bool handled = BaseButton::OnMousePressed(event);
189 return !event.IsOnlyMiddleMouseButton(); 189 // Explicitly mark midle-mouse clicks as non-handled to ensure the tab
Mohamed Mansour (USE mhm) 2009/03/10 21:00:59 nit: spelling error, middle
190 // sees them.
191 return event.IsOnlyMiddleMouseButton() ? false : handled;
190 } 192 }
191 193
192 // We need to let the parent know about mouse state so that it 194 // We need to let the parent know about mouse state so that it
193 // can highlight itself appropriately. Note that Exit events 195 // can highlight itself appropriately. Note that Exit events
194 // fire before Enter events, so this works. 196 // fire before Enter events, so this works.
195 virtual void OnMouseEntered(const views::MouseEvent& event) { 197 virtual void OnMouseEntered(const views::MouseEvent& event) {
196 BaseButton::OnMouseEntered(event); 198 BaseButton::OnMouseEntered(event);
197 GetParent()->OnMouseEntered(event); 199 GetParent()->OnMouseEntered(event);
198 } 200 }
199 201
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 } 697 }
696 698
697 void TabRenderer::DisplayCrashedFavIcon() { 699 void TabRenderer::DisplayCrashedFavIcon() {
698 should_display_crashed_favicon_ = true; 700 should_display_crashed_favicon_ = true;
699 } 701 }
700 702
701 void TabRenderer::ResetCrashedFavIcon() { 703 void TabRenderer::ResetCrashedFavIcon() {
702 should_display_crashed_favicon_ = false; 704 should_display_crashed_favicon_ = false;
703 } 705 }
704 706
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