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

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: 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 887107bfb139d7e30fae4c1b07d9a65d9fbb9aaa..9a90b573eb1a67d25a08186b1edb168921be0c48 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/browser_view.h"
@@ -19,8 +24,10 @@
#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/ui_base_switches.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/screen.h"
@@ -348,8 +355,10 @@ ImmersiveModeControllerAsh::ImmersiveModeControllerAsh()
revealed_lock_count_(0),
tab_indicator_visibility_(TAB_INDICATORS_HIDE),
native_window_(NULL),
+ root_window_(NULL),
weak_ptr_factory_(this),
- gesture_begun_(false) {
+ gesture_begun_(false),
+ bezel_inset_(0) {
}
ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() {
@@ -386,6 +395,8 @@ void ImmersiveModeControllerAsh::Init(BrowserView* browser_view) {
// window pointer so |this| can stop observing during destruction.
native_window_ = browser_view_->GetNativeWindow();
DCHECK(native_window_);
+ root_window_ = native_window_->GetRootWindow();
+ DCHECK(root_window_);
// Optionally allow the tab indicators to be hidden.
if (CommandLine::ForCurrentProcess()->
@@ -394,6 +405,20 @@ void ImmersiveModeControllerAsh::Init(BrowserView* browser_view) {
}
anchored_widget_manager_.reset(new AnchoredWidgetManager(this));
+
+ // Add inset to account for maximum bezel sensor.
+#if defined(USE_XI2_MT)
+ std::vector<std::string> parts;
+ if (Tokenize(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kTouchCalibration), ",", &parts) >= 4) {
+ for (int i = 0; i < 4; i++) {
+ int new_inset;
+ if (base::StringToInt(parts[i], &new_inset)) {
+ bezel_inset_ = std::max(new_inset, bezel_inset_);
+ }
+ }
+ }
+#endif
}
void ImmersiveModeControllerAsh::SetEnabled(bool enabled) {
@@ -673,9 +698,9 @@ void ImmersiveModeControllerAsh::EnableWindowObservers(bool enable) {
}
if (enable)
- native_window_->AddPreTargetHandler(this);
+ root_window_->AddPreTargetHandler(this);
else
- native_window_->RemovePreTargetHandler(this);
+ root_window_->RemovePreTargetHandler(this);
sadrul 2013/05/22 18:22:45 Is it possible for root_window_ to become invalid
rharrison 2013/05/22 20:58:49 Done.
// The window observer adds and removes itself from the native window.
window_observer_.reset(enable ? new WindowObserver(this) : NULL);
@@ -997,6 +1022,9 @@ bool ImmersiveModeControllerAsh::IsNearTopContainer(gfx::Point location) const {
gfx::Rect near_bounds =
browser_view_->top_container()->GetTargetBoundsInScreen();
if (reveal_state_ == CLOSED)
- near_bounds.Inset(gfx::Insets(0, 0, -kNearTopContainerDistance, 0));
+ near_bounds.Inset(gfx::Insets(-bezel_inset_,
+ 0,
+ -kNearTopContainerDistance,
+ 0));
return near_bounds.Contains(location);
sadrul 2013/05/22 18:22:45 Could you just do: return near_bounds.Contains
rharrison 2013/05/22 20:58:49 Done.
}
« 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