Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "ui/base/animation/slide_animation.h" | 24 #include "ui/base/animation/slide_animation.h" |
| 25 #include "ui/base/animation/throb_animation.h" | 25 #include "ui/base/animation/throb_animation.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/base/text/text_elider.h" | 28 #include "ui/base/text/text_elider.h" |
| 29 #include "ui/base/theme_provider.h" | 29 #include "ui/base/theme_provider.h" |
| 30 #include "ui/gfx/canvas_skia.h" | 30 #include "ui/gfx/canvas_skia.h" |
| 31 #include "ui/gfx/favicon_size.h" | 31 #include "ui/gfx/favicon_size.h" |
| 32 #include "ui/gfx/font.h" | 32 #include "ui/gfx/font.h" |
| 33 #include "views/controls/button/image_button.h" | 33 #include "views/controls/button/image_button.h" |
| 34 #include "views/widget/widget.h" | |
|
sky
2011/05/03 18:38:32
Is this needed?
SteveT
2011/05/06 18:48:43
Removed.
| |
| 34 | 35 |
| 35 // How long the pulse throb takes. | 36 // How long the pulse throb takes. |
| 36 static const int kPulseDurationMs = 200; | 37 static const int kPulseDurationMs = 200; |
| 37 | 38 |
| 38 // How long the hover state takes. | 39 // How long the hover state takes. |
| 39 static const int kHoverDurationMs = 400; | 40 static const int kHoverDurationMs = 400; |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 //////////////////////////////////////////////////////////////////////////////// | 44 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 } else if (event.IsShiftDown()) { | 295 } else if (event.IsShiftDown()) { |
| 295 controller()->ExtendSelectionTo(this); | 296 controller()->ExtendSelectionTo(this); |
| 296 } else if (event.IsControlDown()) { | 297 } else if (event.IsControlDown()) { |
| 297 controller()->ToggleSelected(this); | 298 controller()->ToggleSelected(this); |
| 298 if (!IsSelected()) { | 299 if (!IsSelected()) { |
| 299 // Don't allow dragging non-selected tabs. | 300 // Don't allow dragging non-selected tabs. |
| 300 return false; | 301 return false; |
| 301 } | 302 } |
| 302 } else if (!IsSelected()) { | 303 } else if (!IsSelected()) { |
| 303 controller()->SelectTab(this); | 304 controller()->SelectTab(this); |
| 305 } else { | |
| 306 if (IsActive()) { | |
|
sky
2011/05/03 18:38:32
combine with else on 305
SteveT
2011/05/06 18:48:43
Done.
| |
| 307 controller()->ReselectTab(this); | |
| 308 } | |
| 304 } | 309 } |
| 305 controller()->MaybeStartDrag(this, event); | 310 controller()->MaybeStartDrag(this, event); |
| 306 } | 311 } |
| 307 return true; | 312 return true; |
| 308 } | 313 } |
| 309 | 314 |
| 310 bool BaseTab::OnMouseDragged(const views::MouseEvent& event) { | 315 bool BaseTab::OnMouseDragged(const views::MouseEvent& event) { |
| 311 if (controller()) | 316 if (controller()) |
| 312 controller()->ContinueDrag(event); | 317 controller()->ContinueDrag(event); |
| 313 return true; | 318 return true; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 // static | 594 // static |
| 590 void BaseTab::InitResources() { | 595 void BaseTab::InitResources() { |
| 591 static bool initialized = false; | 596 static bool initialized = false; |
| 592 if (!initialized) { | 597 if (!initialized) { |
| 593 initialized = true; | 598 initialized = true; |
| 594 font_ = new gfx::Font( | 599 font_ = new gfx::Font( |
| 595 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); | 600 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); |
| 596 font_height_ = font_->GetHeight(); | 601 font_height_ = font_->GetHeight(); |
| 597 } | 602 } |
| 598 } | 603 } |
| OLD | NEW |