Commit cfdbc458 authored by sky@chromium.org's avatar sky@chromium.org

Enables stacked tabs for aura-metro

Ifdefs weren't quite right.

BUG=315195
TEST=run chrome (aura) in metro mode, touch the tabstrip and move tabs
     around, make sure tabs enter stacked mode.

R=ben@chromium.org

Review URL: https://codereview.chromium.org/60353003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233425 0039d316-1c4b-4281-b951-d872f2087c98
parent 03608d8b
...@@ -50,15 +50,20 @@ TabRendererData::NetworkState TabContentsNetworkState( ...@@ -50,15 +50,20 @@ TabRendererData::NetworkState TabContentsNetworkState(
return TabRendererData::NETWORK_STATE_LOADING; return TabRendererData::NETWORK_STATE_LOADING;
} }
TabStripLayoutType DetermineTabStripLayout(PrefService* prefs, TabStripLayoutType DetermineTabStripLayout(
bool* adjust_layout) { PrefService* prefs,
chrome::HostDesktopType host_desktop_type,
bool* adjust_layout) {
*adjust_layout = false; *adjust_layout = false;
if (CommandLine::ForCurrentProcess()->HasSwitch( if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableStackedTabStrip)) { switches::kEnableStackedTabStrip)) {
return TAB_STRIP_LAYOUT_STACKED; return TAB_STRIP_LAYOUT_STACKED;
} }
// For chromeos always allow entering stacked mode. // For chromeos always allow entering stacked mode.
#if !defined(OS_CHROMEOS) #if defined(USE_AURA)
if (host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH)
return TAB_STRIP_LAYOUT_SHRINK;
#else
if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH)
return TAB_STRIP_LAYOUT_SHRINK; return TAB_STRIP_LAYOUT_SHRINK;
#endif #endif
...@@ -355,7 +360,8 @@ bool BrowserTabStripController::IsIncognito() { ...@@ -355,7 +360,8 @@ bool BrowserTabStripController::IsIncognito() {
void BrowserTabStripController::LayoutTypeMaybeChanged() { void BrowserTabStripController::LayoutTypeMaybeChanged() {
bool adjust_layout = false; bool adjust_layout = false;
TabStripLayoutType layout_type = TabStripLayoutType layout_type =
DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); DetermineTabStripLayout(g_browser_process->local_state(),
browser_->host_desktop_type(), &adjust_layout);
if (!adjust_layout || layout_type == tabstrip_->layout_type()) if (!adjust_layout || layout_type == tabstrip_->layout_type())
return; return;
...@@ -522,6 +528,7 @@ void BrowserTabStripController::AddTab(WebContents* contents, ...@@ -522,6 +528,7 @@ void BrowserTabStripController::AddTab(WebContents* contents,
void BrowserTabStripController::UpdateLayoutType() { void BrowserTabStripController::UpdateLayoutType() {
bool adjust_layout = false; bool adjust_layout = false;
TabStripLayoutType layout_type = TabStripLayoutType layout_type =
DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); DetermineTabStripLayout(g_browser_process->local_state(),
browser_->host_desktop_type(), &adjust_layout);
tabstrip_->SetLayoutType(layout_type, adjust_layout); tabstrip_->SetLayoutType(layout_type, adjust_layout);
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/defaults.h" #include "chrome/browser/defaults.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h"
...@@ -2727,7 +2728,10 @@ bool TabStrip::GetAdjustLayout() const { ...@@ -2727,7 +2728,10 @@ bool TabStrip::GetAdjustLayout() const {
if (!adjust_layout_) if (!adjust_layout_)
return false; return false;
#if !defined(OS_CHROMEOS) #if defined(USE_AURA)
return chrome::GetHostDesktopTypeForNativeView(
GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH;
#else
if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH)
return false; return false;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment