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