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

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

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base_tab.h" 5 #include "chrome/browser/ui/views/tabs/base_tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // In some cases, ending the drag will schedule the tab for destruction; if 354 // In some cases, ending the drag will schedule the tab for destruction; if
355 // so, bail immediately, since our members are already dead and we shouldn't 355 // so, bail immediately, since our members are already dead and we shouldn't
356 // do anything else except drop the tab where it is. 356 // do anything else except drop the tab where it is.
357 if (controller()->EndDrag(false)) 357 if (controller()->EndDrag(false))
358 return; 358 return;
359 359
360 // Close tab on middle click, but only if the button is released over the tab 360 // Close tab on middle click, but only if the button is released over the tab
361 // (normal windows behavior is to discard presses of a UI element where the 361 // (normal windows behavior is to discard presses of a UI element where the
362 // releases happen off the element). 362 // releases happen off the element).
363 if (event.IsMiddleMouseButton()) { 363 if (event.IsMiddleMouseButton()) {
364 if (HitTest(event.location())) { 364 if (HitTestPoint(event.location())) {
365 controller()->CloseTab(this); 365 controller()->CloseTab(this);
366 } else if (closing_) { 366 } else if (closing_) {
367 // We're animating closed and a middle mouse button was pushed on us but 367 // We're animating closed and a middle mouse button was pushed on us but
368 // we don't contain the mouse anymore. We assume the user is clicking 368 // we don't contain the mouse anymore. We assume the user is clicking
369 // quicker than the animation and we should close the tab that falls under 369 // quicker than the animation and we should close the tab that falls under
370 // the mouse. 370 // the mouse.
371 BaseTab* closest_tab = controller()->GetTabAt(this, event.location()); 371 BaseTab* closest_tab = controller()->GetTabAt(this, event.location());
372 if (closest_tab) 372 if (closest_tab)
373 controller()->CloseTab(closest_tab); 373 controller()->CloseTab(closest_tab);
374 } 374 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // static 639 // static
640 void BaseTab::InitResources() { 640 void BaseTab::InitResources() {
641 static bool initialized = false; 641 static bool initialized = false;
642 if (!initialized) { 642 if (!initialized) {
643 initialized = true; 643 initialized = true;
644 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 644 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
645 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont)); 645 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont));
646 font_height_ = font_->GetHeight(); 646 font_height_ = font_->GetHeight();
647 } 647 }
648 } 648 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698