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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 void BaseTab::AnimationEnded(const ui::Animation* animation) { | 582 void BaseTab::AnimationEnded(const ui::Animation* animation) { |
583 SchedulePaint(); | 583 SchedulePaint(); |
584 } | 584 } |
585 | 585 |
586 void BaseTab::ButtonPressed(views::Button* sender, const ui::Event& event) { | 586 void BaseTab::ButtonPressed(views::Button* sender, const ui::Event& event) { |
587 const CloseTabSource source = | 587 const CloseTabSource source = |
588 (event.type() == ui::ET_MOUSE_RELEASED && | 588 (event.type() == ui::ET_MOUSE_RELEASED && |
589 (event.flags() & ui::EF_FROM_TOUCH) == 0) ? CLOSE_TAB_FROM_MOUSE : | 589 (event.flags() & ui::EF_FROM_TOUCH) == 0) ? CLOSE_TAB_FROM_MOUSE : |
590 CLOSE_TAB_FROM_TOUCH; | 590 CLOSE_TAB_FROM_TOUCH; |
591 DCHECK(sender == close_button_); | 591 DCHECK_EQ(close_button_, sender); |
592 controller()->CloseTab(this, source); | 592 controller()->CloseTab(this, source); |
593 } | 593 } |
594 | 594 |
595 void BaseTab::ShowContextMenuForView(views::View* source, | 595 void BaseTab::ShowContextMenuForView(views::View* source, |
596 const gfx::Point& point) { | 596 const gfx::Point& point) { |
597 if (controller() && !closing()) | 597 if (controller() && !closing()) |
598 controller()->ShowContextMenuForTab(this, point); | 598 controller()->ShowContextMenuForTab(this, point); |
599 } | 599 } |
600 | 600 |
601 int BaseTab::loading_animation_frame() const { | 601 int BaseTab::loading_animation_frame() const { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 // static | 656 // static |
657 void BaseTab::InitResources() { | 657 void BaseTab::InitResources() { |
658 static bool initialized = false; | 658 static bool initialized = false; |
659 if (!initialized) { | 659 if (!initialized) { |
660 initialized = true; | 660 initialized = true; |
661 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 661 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
662 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont)); | 662 font_ = new gfx::Font(rb.GetFont(ui::ResourceBundle::BaseFont)); |
663 font_height_ = font_->GetHeight(); | 663 font_height_ = font_->GetHeight(); |
664 } | 664 } |
665 } | 665 } |
OLD | NEW |