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/browser_tab_strip_controller.h" | 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return TabRendererData::NETWORK_STATE_LOADING; | 52 return TabRendererData::NETWORK_STATE_LOADING; |
53 } | 53 } |
54 | 54 |
55 TabStripLayoutType DetermineTabStripLayout(PrefService* prefs, | 55 TabStripLayoutType DetermineTabStripLayout(PrefService* prefs, |
56 bool* adjust_layout) { | 56 bool* adjust_layout) { |
57 *adjust_layout = false; | 57 *adjust_layout = false; |
58 if (CommandLine::ForCurrentProcess()->HasSwitch( | 58 if (CommandLine::ForCurrentProcess()->HasSwitch( |
59 switches::kEnableStackedTabStrip)) { | 59 switches::kEnableStackedTabStrip)) { |
60 return TAB_STRIP_LAYOUT_STACKED; | 60 return TAB_STRIP_LAYOUT_STACKED; |
61 } | 61 } |
| 62 // For chromeos always allow entering stacked mode. |
| 63 #if !defined(OS_CHROMEOS) |
62 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 64 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
63 return TAB_STRIP_LAYOUT_SHRINK; | 65 return TAB_STRIP_LAYOUT_SHRINK; |
| 66 #endif |
64 *adjust_layout = true; | 67 *adjust_layout = true; |
65 switch (prefs->GetInteger(prefs::kTabStripLayoutType)) { | 68 switch (prefs->GetInteger(prefs::kTabStripLayoutType)) { |
66 case TAB_STRIP_LAYOUT_STACKED: | 69 case TAB_STRIP_LAYOUT_STACKED: |
67 return TAB_STRIP_LAYOUT_STACKED; | 70 return TAB_STRIP_LAYOUT_STACKED; |
68 default: | 71 default: |
69 return TAB_STRIP_LAYOUT_SHRINK; | 72 return TAB_STRIP_LAYOUT_SHRINK; |
70 } | 73 } |
71 } | 74 } |
72 | 75 |
73 } // namespace | 76 } // namespace |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); | 579 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); |
577 tabstrip_->AddTabAt(index, data, is_active); | 580 tabstrip_->AddTabAt(index, data, is_active); |
578 } | 581 } |
579 | 582 |
580 void BrowserTabStripController::UpdateLayoutType() { | 583 void BrowserTabStripController::UpdateLayoutType() { |
581 bool adjust_layout = false; | 584 bool adjust_layout = false; |
582 TabStripLayoutType layout_type = | 585 TabStripLayoutType layout_type = |
583 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); | 586 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); |
584 tabstrip_->SetLayoutType(layout_type, adjust_layout); | 587 tabstrip_->SetLayoutType(layout_type, adjust_layout); |
585 } | 588 } |
OLD | NEW |