Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
| 6 | 6 |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 7 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 9 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
| 10 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/string_number_conversions.h" | |
| 15 #include "base/string_util.h" | |
| 11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 16 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 12 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 13 #include "chrome/browser/ui/views/frame/top_container_view.h" | 18 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 16 #include "ui/aura/client/activation_client.h" | 21 #include "ui/aura/client/activation_client.h" |
| 17 #include "ui/aura/client/aura_constants.h" | 22 #include "ui/aura/client/aura_constants.h" |
| 18 #include "ui/aura/client/capture_client.h" | 23 #include "ui/aura/client/capture_client.h" |
| 19 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
| 25 #include "ui/aura/root_window.h" | |
| 20 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_observer.h" | 27 #include "ui/aura/window_observer.h" |
| 22 #include "ui/base/gestures/gesture_configuration.h" | 28 #include "ui/base/gestures/gesture_configuration.h" |
| 29 #include "ui/base/ui_base_switches.h" | |
| 23 #include "ui/compositor/layer_animation_observer.h" | 30 #include "ui/compositor/layer_animation_observer.h" |
| 24 #include "ui/compositor/scoped_layer_animation_settings.h" | 31 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 25 #include "ui/gfx/screen.h" | 32 #include "ui/gfx/screen.h" |
| 26 #include "ui/gfx/transform.h" | 33 #include "ui/gfx/transform.h" |
| 27 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 28 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
| 29 #include "ui/views/window/non_client_view.h" | 36 #include "ui/views/window/non_client_view.h" |
| 30 | 37 |
| 31 using ui::GestureConfiguration; | 38 using ui::GestureConfiguration; |
| 32 using views::View; | 39 using views::View; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 widget_(NULL), | 347 widget_(NULL), |
| 341 top_container_(NULL), | 348 top_container_(NULL), |
| 342 observers_enabled_(false), | 349 observers_enabled_(false), |
| 343 enabled_(false), | 350 enabled_(false), |
| 344 reveal_state_(CLOSED), | 351 reveal_state_(CLOSED), |
| 345 revealed_lock_count_(0), | 352 revealed_lock_count_(0), |
| 346 tab_indicator_visibility_(TAB_INDICATORS_HIDE), | 353 tab_indicator_visibility_(TAB_INDICATORS_HIDE), |
| 347 mouse_x_when_hit_top_(-1), | 354 mouse_x_when_hit_top_(-1), |
| 348 native_window_(NULL), | 355 native_window_(NULL), |
| 349 weak_ptr_factory_(this), | 356 weak_ptr_factory_(this), |
| 350 gesture_begun_(false) { | 357 gesture_begun_(false), |
| 358 bezel_inset_(0) { | |
|
pkotwicz
2013/05/23 03:29:35
You don't use this?
rharrison
2013/05/23 17:12:57
Done.
| |
| 351 } | 359 } |
| 352 | 360 |
| 353 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { | 361 ImmersiveModeControllerAsh::~ImmersiveModeControllerAsh() { |
| 354 // The browser view is being destroyed so there's no need to update its | 362 // The browser view is being destroyed so there's no need to update its |
| 355 // layout or layers, even if the top views are revealed. But the window | 363 // layout or layers, even if the top views are revealed. But the window |
| 356 // observers still need to be removed. | 364 // observers still need to be removed. |
| 357 EnableWindowObservers(false); | 365 EnableWindowObservers(false); |
| 358 } | 366 } |
| 359 | 367 |
| 360 void ImmersiveModeControllerAsh::LockRevealedState( | 368 void ImmersiveModeControllerAsh::LockRevealedState( |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 views::Widget::GetWidgetForNativeWindow(native_window_); | 663 views::Widget::GetWidgetForNativeWindow(native_window_); |
| 656 views::FocusManager* focus_manager = widget->GetFocusManager(); | 664 views::FocusManager* focus_manager = widget->GetFocusManager(); |
| 657 if (enable) { | 665 if (enable) { |
| 658 widget->AddObserver(this); | 666 widget->AddObserver(this); |
| 659 focus_manager->AddFocusChangeListener(this); | 667 focus_manager->AddFocusChangeListener(this); |
| 660 } else { | 668 } else { |
| 661 widget->RemoveObserver(this); | 669 widget->RemoveObserver(this); |
| 662 focus_manager->RemoveFocusChangeListener(this); | 670 focus_manager->RemoveFocusChangeListener(this); |
| 663 } | 671 } |
| 664 | 672 |
| 673 aura::RootWindow* root_window = native_window_->GetRootWindow(); | |
| 665 if (enable) | 674 if (enable) |
| 666 native_window_->AddPreTargetHandler(this); | 675 root_window->AddPreTargetHandler(this); |
| 667 else | 676 else |
| 668 native_window_->RemovePreTargetHandler(this); | 677 root_window->RemovePreTargetHandler(this); |
| 669 | 678 |
| 670 // The window observer adds and removes itself from the native window. | 679 // The window observer adds and removes itself from the native window. |
| 671 window_observer_.reset(enable ? new WindowObserver(this) : NULL); | 680 window_observer_.reset(enable ? new WindowObserver(this) : NULL); |
| 672 | 681 |
| 673 if (enable) { | 682 if (enable) { |
| 674 registrar_.Add( | 683 registrar_.Add( |
| 675 this, | 684 this, |
| 676 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 685 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 677 content::Source<FullscreenController>( | 686 content::Source<FullscreenController>( |
| 678 delegate_->GetFullscreenController())); | 687 delegate_->GetFullscreenController())); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 return SWIPE_CLOSE; | 1033 return SWIPE_CLOSE; |
| 1025 else if (event->details().scroll_y() > 0) | 1034 else if (event->details().scroll_y() > 0) |
| 1026 return SWIPE_OPEN; | 1035 return SWIPE_OPEN; |
| 1027 return SWIPE_NONE; | 1036 return SWIPE_NONE; |
| 1028 } | 1037 } |
| 1029 | 1038 |
| 1030 bool ImmersiveModeControllerAsh::IsNearTopContainer(gfx::Point location) const { | 1039 bool ImmersiveModeControllerAsh::IsNearTopContainer(gfx::Point location) const { |
| 1031 gfx::Rect near_bounds = top_container_->GetTargetBoundsInScreen(); | 1040 gfx::Rect near_bounds = top_container_->GetTargetBoundsInScreen(); |
| 1032 if (reveal_state_ == CLOSED) | 1041 if (reveal_state_ == CLOSED) |
| 1033 near_bounds.Inset(gfx::Insets(0, 0, -kNearTopContainerDistance, 0)); | 1042 near_bounds.Inset(gfx::Insets(0, 0, -kNearTopContainerDistance, 0)); |
| 1034 return near_bounds.Contains(location); | 1043 return near_bounds.Contains(location) || |
| 1044 ((location.y() < near_bounds.y()) && | |
| 1045 (location.x() >= near_bounds.x()) && | |
| 1046 (location.x() <= near_bounds.x() + near_bounds.width())); | |
| 1035 } | 1047 } |
| OLD | NEW |