| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/immersive_revealed_lock.h" | |
| 9 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "chrome/browser/ui/views/frame/top_container_view.h" | 12 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 14 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 13 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 15 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 18 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 switch (animate_reveal) { | 33 switch (animate_reveal) { |
| 35 case ImmersiveModeController::ANIMATE_REVEAL_YES: | 34 case ImmersiveModeController::ANIMATE_REVEAL_YES: |
| 36 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_YES; | 35 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_YES; |
| 37 case ImmersiveModeController::ANIMATE_REVEAL_NO: | 36 case ImmersiveModeController::ANIMATE_REVEAL_NO: |
| 38 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_NO; | 37 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_NO; |
| 39 } | 38 } |
| 40 NOTREACHED(); | 39 NOTREACHED(); |
| 41 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_NO; | 40 return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_NO; |
| 42 } | 41 } |
| 43 | 42 |
| 44 class ImmersiveRevealedLockAsh : public ImmersiveRevealedLock { | |
| 45 public: | |
| 46 explicit ImmersiveRevealedLockAsh(ash::ImmersiveRevealedLock* lock) | |
| 47 : lock_(lock) {} | |
| 48 | |
| 49 private: | |
| 50 scoped_ptr<ash::ImmersiveRevealedLock> lock_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(ImmersiveRevealedLockAsh); | |
| 53 }; | |
| 54 | |
| 55 } // namespace | 43 } // namespace |
| 56 | 44 |
| 57 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() | 45 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() |
| 58 : controller_(new ash::ImmersiveFullscreenController), | 46 : controller_(new ash::ImmersiveFullscreenController), |
| 59 browser_view_(NULL), | 47 browser_view_(NULL), |
| 60 native_window_(NULL), | 48 native_window_(NULL), |
| 61 observers_enabled_(false), | 49 observers_enabled_(false), |
| 62 use_tab_indicators_(false), | 50 use_tab_indicators_(false), |
| 63 visible_fraction_(1) { | 51 visible_fraction_(1) { |
| 64 } | 52 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // |browser_view_|. | 101 // |browser_view_|. |
| 114 if (!IsRevealed()) | 102 if (!IsRevealed()) |
| 115 return 0; | 103 return 0; |
| 116 | 104 |
| 117 int height = top_container_size.height() - kAnimationOffsetY; | 105 int height = top_container_size.height() - kAnimationOffsetY; |
| 118 return static_cast<int>(height * (visible_fraction_ - 1)); | 106 return static_cast<int>(height * (visible_fraction_ - 1)); |
| 119 } | 107 } |
| 120 | 108 |
| 121 ImmersiveRevealedLock* ImmersiveModeControllerAsh::GetRevealedLock( | 109 ImmersiveRevealedLock* ImmersiveModeControllerAsh::GetRevealedLock( |
| 122 AnimateReveal animate_reveal) { | 110 AnimateReveal animate_reveal) { |
| 123 return new ImmersiveRevealedLockAsh(controller_->GetRevealedLock( | 111 return controller_->GetRevealedLock( |
| 124 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal))); | 112 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal)); |
| 125 } | 113 } |
| 126 | 114 |
| 127 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( | 115 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( |
| 128 const gfx::Rect& new_visible_bounds_in_screen) { | 116 const gfx::Rect& new_visible_bounds_in_screen) { |
| 129 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; | 117 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; |
| 130 } | 118 } |
| 131 | 119 |
| 132 void ImmersiveModeControllerAsh::SetupForTest() { | 120 void ImmersiveModeControllerAsh::SetupForTest() { |
| 133 controller_->SetupForTest(); | 121 controller_->SetupForTest(); |
| 134 } | 122 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // prevent it from being revealed. | 241 // prevent it from being revealed. |
| 254 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> | 242 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> |
| 255 IsWindowFullscreenForTabOrPending(); | 243 IsWindowFullscreenForTabOrPending(); |
| 256 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( | 244 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( |
| 257 in_tab_fullscreen); | 245 in_tab_fullscreen); |
| 258 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 246 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
| 259 | 247 |
| 260 if (tab_indicator_visibility_changed) | 248 if (tab_indicator_visibility_changed) |
| 261 LayoutBrowserRootView(); | 249 LayoutBrowserRootView(); |
| 262 } | 250 } |
| OLD | NEW |