Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
| diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
| index f88871dc5149f53c20676153dbd3832bc0dca539..c16be9de44f89b2981d2b7eae6ef8899aa1af53f 100644 |
| --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
| +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
| @@ -59,25 +59,17 @@ TabRendererData::NetworkState TabContentsNetworkState( |
| return TabRendererData::NETWORK_STATE_LOADING; |
| } |
| -TabStripLayoutType DetermineTabStripLayout( |
| +bool DetermineTabStripLayoutStacked( |
| PrefService* prefs, |
| chrome::HostDesktopType host_desktop_type, |
| bool* adjust_layout) { |
| *adjust_layout = false; |
| - if (CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kEnableStackedTabStrip)) { |
| - return TAB_STRIP_LAYOUT_STACKED; |
| - } |
| // For ash, always allow entering stacked mode. |
| if (host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) |
| - return TAB_STRIP_LAYOUT_SHRINK; |
| + return false; |
| *adjust_layout = true; |
| - switch (prefs->GetInteger(prefs::kTabStripLayoutType)) { |
| - case TAB_STRIP_LAYOUT_STACKED: |
| - return TAB_STRIP_LAYOUT_STACKED; |
| - default: |
| - return TAB_STRIP_LAYOUT_SHRINK; |
| - } |
| + return (prefs->GetInteger(prefs::kTabStripLayoutType) == |
| + TAB_STRIP_LAYOUT_STACKED); |
|
sky
2014/05/21 22:57:19
Seems silly to keep the enum and not use it. I bel
varkha
2014/05/23 17:43:23
Right, I left the enum as a way to document the va
|
| } |
| // Get the MIME type of the file pointed to by the url, based on the file's |
| @@ -392,15 +384,17 @@ bool BrowserTabStripController::IsIncognito() { |
| void BrowserTabStripController::LayoutTypeMaybeChanged() { |
| bool adjust_layout = false; |
| - TabStripLayoutType layout_type = |
| - DetermineTabStripLayout(g_browser_process->local_state(), |
| - browser_->host_desktop_type(), &adjust_layout); |
| - if (!adjust_layout || layout_type == tabstrip_->layout_type()) |
| + bool layout_type_stacked = |
| + DetermineTabStripLayoutStacked(g_browser_process->local_state(), |
| + browser_->host_desktop_type(), |
| + &adjust_layout); |
| + if (!adjust_layout || layout_type_stacked == tabstrip_->layout_type_stacked()) |
| return; |
| g_browser_process->local_state()->SetInteger( |
| prefs::kTabStripLayoutType, |
| - static_cast<int>(tabstrip_->layout_type())); |
| + static_cast<int>(tabstrip_->layout_type_stacked() ? |
| + TAB_STRIP_LAYOUT_STACKED : TAB_STRIP_LAYOUT_SHRINK)); |
| } |
| void BrowserTabStripController::OnStartedDraggingTabs() { |
| @@ -570,10 +564,12 @@ void BrowserTabStripController::AddTab(WebContents* contents, |
| void BrowserTabStripController::UpdateLayoutType() { |
| bool adjust_layout = false; |
| - TabStripLayoutType layout_type = |
| - DetermineTabStripLayout(g_browser_process->local_state(), |
| - browser_->host_desktop_type(), &adjust_layout); |
| - tabstrip_->SetLayoutType(layout_type, adjust_layout); |
| + bool layout_type_stacked = |
| + DetermineTabStripLayoutStacked(g_browser_process->local_state(), |
| + browser_->host_desktop_type(), |
| + &adjust_layout); |
| + tabstrip_->set_adjust_layout(adjust_layout); |
| + tabstrip_->SetLayoutTypeStacked(layout_type_stacked); |
| } |
| void BrowserTabStripController::OnFindURLMimeTypeCompleted( |