Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc

Issue 15734011: Correct immersive mode gestures under rotation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Other part of the change to address pkotwicz's comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/immersive_mode_controller_ash.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
index 7ddfa601b40da527dc4b1944f9d312499e567d1d..32eb7c8d85b6f6ec152669657d486f0957541488 100644
--- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
+++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc
@@ -4,10 +4,15 @@
#include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h"
+#include <string>
+#include <vector>
+
#include "ash/ash_switches.h"
#include "ash/shell.h"
#include "ash/wm/window_properties.h"
#include "base/command_line.h"
+#include "base/string_number_conversions.h"
+#include "base/string_util.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
@@ -17,9 +22,11 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/env.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/base/gestures/gesture_configuration.h"
+#include "ui/base/ui_base_switches.h"
sadrul 2013/05/23 18:22:07 I think you don't need most of the new #includes
rharrison 2013/05/23 19:10:11 Done.
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/screen.h"
@@ -302,11 +309,12 @@ class ImmersiveModeControllerAsh::WindowObserver : public aura::WindowObserver {
public:
explicit WindowObserver(ImmersiveModeControllerAsh* controller)
: controller_(controller) {
- controller_->native_window_->AddObserver(this);
+ window_ = controller_->native_window_;
+ window_->AddObserver(this);
}
virtual ~WindowObserver() {
- controller_->native_window_->RemoveObserver(this);
+ window_->RemoveObserver(this);
}
// aura::WindowObserver overrides:
@@ -327,8 +335,14 @@ class ImmersiveModeControllerAsh::WindowObserver : public aura::WindowObserver {
}
}
+ virtual void OnWindowAddedToRootWindow(aura::Window* window) {
+ if (window == window_)
sadrul 2013/05/23 18:22:07 DCHECK_EQ(window_, window) instead.
rharrison 2013/05/23 19:10:11 Done.
+ controller_->SetPreTargetHandler();
sadrul 2013/05/23 18:22:07 Do you need to override OnWindowRemovedFromRootWin
rharrison 2013/05/23 19:10:11 Done.
+ }
+
private:
ImmersiveModeControllerAsh* controller_; // Not owned.
+ aura::Window* window_; // Not owned.
DISALLOW_COPY_AND_ASSIGN(WindowObserver);
};
@@ -378,6 +392,18 @@ void ImmersiveModeControllerAsh::MaybeRevealWithoutAnimation() {
MaybeStartReveal(ANIMATE_NO);
}
+void ImmersiveModeControllerAsh::SetPreTargetHandler() {
+ if (!native_window_)
+ return;
+ aura::RootWindow* root_window = native_window_->GetRootWindow();
+ if (!root_window)
+ return;
+ if (observers_enabled_)
+ root_window->AddPreTargetHandler(this);
+ else
+ root_window->RemovePreTargetHandler(this);
+}
+
void ImmersiveModeControllerAsh::Init(
Delegate* delegate,
views::Widget* widget,
@@ -662,10 +688,7 @@ void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) {
focus_manager->RemoveFocusChangeListener(this);
}
- if (enable)
- native_window_->AddPreTargetHandler(this);
- else
- native_window_->RemovePreTargetHandler(this);
+ SetPreTargetHandler();
// The window observer adds and removes itself from the native window.
window_observer_.reset(enable ? new WindowObserver(this) : NULL);
@@ -1031,5 +1054,8 @@ bool ImmersiveModeControllerAsh::IsNearTopContainer(gfx::Point location) const {
gfx::Rect near_bounds = top_container_->GetTargetBoundsInScreen();
if (reveal_state_ == CLOSED)
near_bounds.Inset(gfx::Insets(0, 0, -kNearTopContainerDistance, 0));
- return near_bounds.Contains(location);
+ return near_bounds.Contains(location) ||
+ ((location.y() < near_bounds.y()) &&
+ (location.x() >= near_bounds.x()) &&
+ (location.x() <= near_bounds.x() + near_bounds.width()));
}
« no previous file with comments | « chrome/browser/ui/views/frame/immersive_mode_controller_ash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698