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..fcece94ad1a6e2ec58db8c84ba87ca9384a0df7c 100644 |
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc |
@@ -22,6 +22,7 @@ |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_tabstrip.h" |
#include "chrome/browser/ui/tabs/tab_menu_model.h" |
+#include "chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
#include "chrome/browser/ui/tabs/tab_utils.h" |
@@ -59,25 +60,16 @@ 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 chrome::TabStripLayoutTypePrefs::GetStackedLayout(prefs); |
} |
// Get the MIME type of the file pointed to by the url, based on the file's |
@@ -392,15 +384,16 @@ 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 stacked_layout = |
+ DetermineTabStripLayoutStacked(g_browser_process->local_state(), |
+ browser_->host_desktop_type(), |
+ &adjust_layout); |
+ if (!adjust_layout || stacked_layout == tabstrip_->stacked_layout()) |
return; |
- g_browser_process->local_state()->SetInteger( |
- prefs::kTabStripLayoutType, |
- static_cast<int>(tabstrip_->layout_type())); |
+ chrome::TabStripLayoutTypePrefs::SetStackedLayout( |
+ g_browser_process->local_state(), |
+ tabstrip_->stacked_layout()); |
} |
void BrowserTabStripController::OnStartedDraggingTabs() { |
@@ -570,10 +563,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 stacked_layout = |
+ DetermineTabStripLayoutStacked(g_browser_process->local_state(), |
+ browser_->host_desktop_type(), |
+ &adjust_layout); |
+ tabstrip_->set_adjust_layout(adjust_layout); |
+ tabstrip_->SetStackedLayout(stacked_layout); |
} |
void BrowserTabStripController::OnFindURLMimeTypeCompleted( |