Index: chrome/browser/ui/tabs/tab_utils.cc |
diff --git a/chrome/browser/ui/tabs/tab_utils.cc b/chrome/browser/ui/tabs/tab_utils.cc |
index 1f17621f9057367f076a8a60bfc4a6d613ac76b8..a90b0bc4f494cf4ed47ba046129d432633b60d57 100644 |
--- a/chrome/browser/ui/tabs/tab_utils.cc |
+++ b/chrome/browser/ui/tabs/tab_utils.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/media/media_capture_devices_dispatcher.h" |
#include "chrome/browser/media/media_stream_capture_indicator.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
+#include "chrome/browser/ui/views/tabs/tab.h" |
tdanderson
2015/02/06 20:34:33
I added this so that I can access the static metho
tdanderson
2015/02/10 18:52:17
No longer an issue since I've moved the new logic
|
#include "chrome/common/chrome_switches.h" |
#include "chrome/grit/generated_resources.h" |
#include "content/public/browser/web_contents.h" |
@@ -80,6 +81,8 @@ TabRecordingIndicatorAnimation::Create() { |
} // namespace |
bool ShouldTabShowFavicon(int capacity, |
+ int width, |
+ bool touch_used_last, |
bool is_pinned_tab, |
bool is_active_tab, |
bool has_favicon, |
@@ -87,36 +90,67 @@ bool ShouldTabShowFavicon(int capacity, |
if (!has_favicon) |
return false; |
int required_capacity = 1; |
- if (ShouldTabShowCloseButton(capacity, is_pinned_tab, is_active_tab)) |
+ if (ShouldTabShowCloseButton(capacity, |
+ width, |
+ touch_used_last, |
+ is_pinned_tab, |
+ is_active_tab)) { |
++required_capacity; |
- if (ShouldTabShowMediaIndicator( |
- capacity, is_pinned_tab, is_active_tab, has_favicon, media_state)) { |
+ } |
+ if (ShouldTabShowMediaIndicator(capacity, |
+ width, |
+ touch_used_last, |
+ is_pinned_tab, |
+ is_active_tab, |
+ has_favicon, |
+ media_state)) { |
++required_capacity; |
} |
return capacity >= required_capacity; |
} |
bool ShouldTabShowMediaIndicator(int capacity, |
+ int width, |
+ bool touch_used_last, |
bool is_pinned_tab, |
bool is_active_tab, |
bool has_favicon, |
TabMediaState media_state) { |
if (media_state == TAB_MEDIA_STATE_NONE) |
return false; |
- if (ShouldTabShowCloseButton(capacity, is_pinned_tab, is_active_tab)) |
+ if (ShouldTabShowCloseButton(capacity, |
+ width, |
+ touch_used_last, |
+ is_pinned_tab, |
+ is_active_tab)) { |
return capacity >= 2; |
+ } |
return capacity >= 1; |
} |
bool ShouldTabShowCloseButton(int capacity, |
+ int width, |
+ bool touch_used_last, |
bool is_pinned_tab, |
bool is_active_tab) { |
if (is_pinned_tab) |
return false; |
else if (is_active_tab) |
return true; |
- else |
- return capacity >= 3; |
+ |
+ if (touch_used_last) { |
+ std::string switch_value = |
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
+ switches::kTabCloseButtonsHiddenWithTouch); |
+ if (switch_value == "always") |
sky
2015/02/07 00:09:39
This code is basically saying if touch_used_last (
tdanderson
2015/02/10 18:52:17
Done.
|
+ return false; |
+ else if (switch_value == "narrow" && width < Tab::GetStandardSize().width()) |
+ return false; |
+ else if (switch_value == "stacked" && width <= Tab::GetTouchWidth()) |
+ return false; |
+ } |
+ |
+ return capacity >= 3; |
} |
bool IsPlayingAudio(content::WebContents* contents) { |