OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |