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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 tab_->controller()->OnMouseEventInTab(this, event); | 76 tab_->controller()->OnMouseEventInTab(this, event); |
77 CustomButton::OnMouseReleased(event); | 77 CustomButton::OnMouseReleased(event); |
78 } | 78 } |
79 | 79 |
80 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { | 80 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { |
81 CustomButton::OnMouseExited(event); | 81 CustomButton::OnMouseExited(event); |
82 parent()->OnMouseExited(event); | 82 parent()->OnMouseExited(event); |
83 } | 83 } |
84 | 84 |
85 virtual ui::GestureStatus OnGestureEvent( | 85 virtual ui::GestureStatus OnGestureEvent( |
86 const views::GestureEvent& event) OVERRIDE { | 86 const ui::GestureEvent& event) OVERRIDE { |
87 // Consume all gesture events here so that the parent (BaseTab) does not | 87 // Consume all gesture events here so that the parent (BaseTab) does not |
88 // start consuming gestures. | 88 // start consuming gestures. |
89 ImageButton::OnGestureEvent(event); | 89 ImageButton::OnGestureEvent(event); |
90 return ui::GESTURE_STATUS_CONSUMED; | 90 return ui::GESTURE_STATUS_CONSUMED; |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 BaseTab* tab_; | 94 BaseTab* tab_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(TabCloseButton); | 96 DISALLOW_COPY_AND_ASSIGN(TabCloseButton); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 void BaseTab::OnMouseMoved(const ui::MouseEvent& event) { | 393 void BaseTab::OnMouseMoved(const ui::MouseEvent& event) { |
394 if (controller()) | 394 if (controller()) |
395 controller()->OnMouseEventInTab(this, event); | 395 controller()->OnMouseEventInTab(this, event); |
396 } | 396 } |
397 | 397 |
398 void BaseTab::OnMouseExited(const ui::MouseEvent& event) { | 398 void BaseTab::OnMouseExited(const ui::MouseEvent& event) { |
399 hover_controller_.Hide(); | 399 hover_controller_.Hide(); |
400 } | 400 } |
401 | 401 |
402 ui::GestureStatus BaseTab::OnGestureEvent(const views::GestureEvent& event) { | 402 ui::GestureStatus BaseTab::OnGestureEvent(const ui::GestureEvent& event) { |
403 if (!controller()) | 403 if (!controller()) |
404 return ui::GESTURE_STATUS_CONSUMED; | 404 return ui::GESTURE_STATUS_CONSUMED; |
405 | 405 |
406 switch (event.type()) { | 406 switch (event.type()) { |
407 case ui::ET_GESTURE_BEGIN: { | 407 case ui::ET_GESTURE_BEGIN: { |
408 if (event.details().touch_points() != 1) | 408 if (event.details().touch_points() != 1) |
409 return ui::GESTURE_STATUS_UNKNOWN; | 409 return ui::GESTURE_STATUS_UNKNOWN; |
410 | 410 |
411 TabStripSelectionModel original_selection; | 411 TabStripSelectionModel original_selection; |
412 original_selection.Copy(controller()->GetSelectionModel()); | 412 original_selection.Copy(controller()->GetSelectionModel()); |
(...skipping 226 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 |