Commit 3e3f75c9 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Don't close tabstrip on resize in ChromeOS

See attached bug.

Bug: 1135317
Change-Id: I4a60b5266b20e246bea14e9330fa41c8a743091d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2458747Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814923}
parent 75bb1ae7
...@@ -236,9 +236,12 @@ class WebUITabStripContainerView::AutoCloser : public ui::EventHandler, ...@@ -236,9 +236,12 @@ class WebUITabStripContainerView::AutoCloser : public ui::EventHandler,
DCHECK(top_container_); DCHECK(top_container_);
DCHECK(content_area_); DCHECK(content_area_);
DCHECK(omnibox_); DCHECK(omnibox_);
view_observer_.Add(top_container_);
view_observer_.Add(content_area_); view_observer_.Add(content_area_);
view_observer_.Add(omnibox_); view_observer_.Add(omnibox_);
#if defined(OS_WIN)
view_observer_.Add(top_container_);
#endif // defined(OS_WIN)
// Our observed Widget's NativeView may be destroyed before us. We // Our observed Widget's NativeView may be destroyed before us. We
// have no reasonable way of un-registering our pre-target handler // have no reasonable way of un-registering our pre-target handler
...@@ -828,6 +831,7 @@ gfx::Size WebUITabStripContainerView::FlexRule( ...@@ -828,6 +831,7 @@ gfx::Size WebUITabStripContainerView::FlexRule(
} }
void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) { void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) {
#if defined(OS_WIN)
if (observed_view == top_container_) { if (observed_view == top_container_) {
if (old_top_container_width_ != top_container_->width()) { if (old_top_container_width_ != top_container_->width()) {
old_top_container_width_ = top_container_->width(); old_top_container_width_ = top_container_->width();
...@@ -835,7 +839,11 @@ void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) { ...@@ -835,7 +839,11 @@ void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) {
drag_to_open_handler_->CancelDrag(); drag_to_open_handler_->CancelDrag();
CloseContainer(); CloseContainer();
} }
} else if (observed_view == tab_contents_container_) { return;
}
#endif // defined(OS_WIN)
if (observed_view == tab_contents_container_) {
// TODO(pbos): PreferredSizeChanged seems to cause infinite recursion with // TODO(pbos): PreferredSizeChanged seems to cause infinite recursion with
// BrowserView::ChildPreferredSizeChanged. InvalidateLayout here should be // BrowserView::ChildPreferredSizeChanged. InvalidateLayout here should be
// replaceable with PreferredSizeChanged. // replaceable with PreferredSizeChanged.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_embedder.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_embedder.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h" #include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h"
...@@ -139,10 +140,16 @@ class WebUITabStripContainerView : public TabStripUIEmbedder, ...@@ -139,10 +140,16 @@ class WebUITabStripContainerView : public TabStripUIEmbedder,
views::View* tab_contents_container_; views::View* tab_contents_container_;
views::View* tab_counter_ = nullptr; views::View* tab_counter_ = nullptr;
#if defined(OS_WIN)
// If the user interacts with Windows in a way that changes the width of the // If the user interacts with Windows in a way that changes the width of the
// window, close the top container. This is similar to the auto-close when the // window, close the top container. This is similar to the auto-close when the
// user touches outside the tabstrip. // user touches outside the tabstrip.
//
// TODO(dfried, davidbienvenu): we can remove this as soon as we move to the
// more modern Windows drag-drop system, avoiding some of the weirdness around
// starting drag-drop.
int old_top_container_width_ = 0; int old_top_container_width_ = 0;
#endif // defined(OS_WIN)
base::Optional<float> current_drag_height_; base::Optional<float> current_drag_height_;
......
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