OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/views/tabs/tab_strip.h" |
6 | 6 |
7 #include "app/animation_container.h" | 7 #include "app/animation_container.h" |
8 #include "app/drag_drop_types.h" | 8 #include "app/drag_drop_types.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/os_exchange_data.h" | 10 #include "app/os_exchange_data.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
12 #include "app/slide_animation.h" | 12 #include "app/slide_animation.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
| 16 #include "base/string_util.h" |
16 #include "chrome/browser/browser.h" | 17 #include "chrome/browser/browser.h" |
17 #include "chrome/browser/browser_theme_provider.h" | 18 #include "chrome/browser/browser_theme_provider.h" |
18 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
19 #include "chrome/browser/metrics/user_metrics.h" | 20 #include "chrome/browser/metrics/user_metrics.h" |
20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
21 #include "chrome/browser/renderer_host/render_view_host.h" | 22 #include "chrome/browser/renderer_host/render_view_host.h" |
22 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
23 #include "chrome/browser/tabs/tab_strip_model.h" | 24 #include "chrome/browser/tabs/tab_strip_model.h" |
24 #include "chrome/browser/view_ids.h" | 25 #include "chrome/browser/view_ids.h" |
25 #include "chrome/browser/views/app_launcher.h" | 26 #include "chrome/browser/views/app_launcher.h" |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 // right edge of the TabStrip's bounds, rather than the right edge of the | 1407 // right edge of the TabStrip's bounds, rather than the right edge of the |
1407 // right-most Tab, otherwise it'll bounce when animating. | 1408 // right-most Tab, otherwise it'll bounce when animating. |
1408 new_tab_x = width() - newtab_button_bounds_.width(); | 1409 new_tab_x = width() - newtab_button_bounds_.width(); |
1409 } else { | 1410 } else { |
1410 new_tab_x = Round(tab_x - kTabHOffset) + kNewTabButtonHOffset; | 1411 new_tab_x = Round(tab_x - kTabHOffset) + kNewTabButtonHOffset; |
1411 } | 1412 } |
1412 newtab_button_bounds_.set_origin(gfx::Point(new_tab_x, new_tab_y)); | 1413 newtab_button_bounds_.set_origin(gfx::Point(new_tab_x, new_tab_y)); |
1413 } | 1414 } |
1414 | 1415 |
1415 void TabStrip::NewTabAnimation1Done() { | 1416 void TabStrip::NewTabAnimation1Done() { |
| 1417 #if defined(OS_LINUX) |
| 1418 std::string details(IntToString(GetTabCount())); |
| 1419 |
| 1420 for (size_t i = 0; i < tab_data_.size(); ++i) { |
| 1421 if (tab_data_[i].tab->closing()) |
| 1422 details += " " + IntToString(static_cast<int>(i)); |
| 1423 } |
| 1424 |
| 1425 LOG(ERROR) << " NewTabAnimation1Done details=" << details; |
| 1426 #endif |
| 1427 |
1416 int tab_data_index = static_cast<int>(tab_data_.size() - 1); | 1428 int tab_data_index = static_cast<int>(tab_data_.size() - 1); |
1417 Tab* tab = GetTabAtTabDataIndex(tab_data_index); | 1429 Tab* tab = GetTabAtTabDataIndex(tab_data_index); |
1418 | 1430 |
1419 gfx::Rect old_tab_bounds = tab->bounds(); | 1431 gfx::Rect old_tab_bounds = tab->bounds(); |
1420 | 1432 |
1421 GenerateIdealBounds(); | 1433 GenerateIdealBounds(); |
1422 | 1434 |
1423 gfx::Rect& end_bounds = tab_data_[tab_data_index].ideal_bounds; | 1435 gfx::Rect& end_bounds = tab_data_[tab_data_index].ideal_bounds; |
1424 end_bounds.Offset(kNewTabOvershoot, 0); | 1436 end_bounds.Offset(kNewTabOvershoot, 0); |
1425 | 1437 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 ResetAnimationState(false); | 1612 ResetAnimationState(false); |
1601 } | 1613 } |
1602 | 1614 |
1603 DCHECK(!IsAnimating()); | 1615 DCHECK(!IsAnimating()); |
1604 | 1616 |
1605 if (layout) | 1617 if (layout) |
1606 Layout(); | 1618 Layout(); |
1607 } | 1619 } |
1608 | 1620 |
1609 void TabStrip::ResetAnimationState(bool stop_new_tab_timer) { | 1621 void TabStrip::ResetAnimationState(bool stop_new_tab_timer) { |
| 1622 #if defined(OS_LINUX) |
| 1623 LOG(ERROR) << " ResetAnimationState stop=" << stop_new_tab_timer; |
| 1624 #endif |
| 1625 |
1610 if (animation_type_ == ANIMATION_NEW_TAB_2) | 1626 if (animation_type_ == ANIMATION_NEW_TAB_2) |
1611 newtab_button_->SchedulePaint(); | 1627 newtab_button_->SchedulePaint(); |
1612 | 1628 |
1613 if (stop_new_tab_timer) | 1629 if (stop_new_tab_timer) |
1614 new_tab_timer_.Stop(); | 1630 new_tab_timer_.Stop(); |
1615 | 1631 |
1616 animation_type_ = ANIMATION_DEFAULT; | 1632 animation_type_ = ANIMATION_DEFAULT; |
1617 | 1633 |
1618 // Reset the animation state of each tab. | 1634 // Reset the animation state of each tab. |
1619 for (int i = 0, count = GetTabCount(); i < count; ++i) { | 1635 for (int i = 0, count = GetTabCount(); i < count; ++i) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 return tab_data_.size(); | 1730 return tab_data_.size(); |
1715 } | 1731 } |
1716 | 1732 |
1717 int TabStrip::TabDataIndexOfTab(Tab* tab) const { | 1733 int TabStrip::TabDataIndexOfTab(Tab* tab) const { |
1718 for (size_t i = 0; i < tab_data_.size(); ++i) { | 1734 for (size_t i = 0; i < tab_data_.size(); ++i) { |
1719 if (tab_data_[i].tab == tab) | 1735 if (tab_data_[i].tab == tab) |
1720 return i; | 1736 return i; |
1721 } | 1737 } |
1722 return -1; | 1738 return -1; |
1723 } | 1739 } |
OLD | NEW |