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 "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 }; | |
|
tapted
2014/11/04 02:33:43
nit: DISALLOW_COPY_AND_ASSIGN(..)
Andre
2014/11/05 02:04:23
Done.
| |
| 52 | |
| 43 } // namespace | 53 } // namespace |
| 44 | 54 |
| 45 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() | 55 ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() |
| 46 : controller_(new ash::ImmersiveFullscreenController), | 56 : controller_(new ash::ImmersiveFullscreenController), |
| 47 browser_view_(NULL), | 57 browser_view_(NULL), |
| 48 native_window_(NULL), | 58 native_window_(NULL), |
| 49 observers_enabled_(false), | 59 observers_enabled_(false), |
| 50 use_tab_indicators_(false), | 60 use_tab_indicators_(false), |
| 51 visible_fraction_(1) { | 61 visible_fraction_(1) { |
| 52 } | 62 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // |browser_view_|. | 111 // |browser_view_|. |
| 102 if (!IsRevealed()) | 112 if (!IsRevealed()) |
| 103 return 0; | 113 return 0; |
| 104 | 114 |
| 105 int height = top_container_size.height() - kAnimationOffsetY; | 115 int height = top_container_size.height() - kAnimationOffsetY; |
| 106 return static_cast<int>(height * (visible_fraction_ - 1)); | 116 return static_cast<int>(height * (visible_fraction_ - 1)); |
| 107 } | 117 } |
| 108 | 118 |
| 109 ImmersiveRevealedLock* ImmersiveModeControllerAsh::GetRevealedLock( | 119 ImmersiveRevealedLock* ImmersiveModeControllerAsh::GetRevealedLock( |
| 110 AnimateReveal animate_reveal) { | 120 AnimateReveal animate_reveal) { |
| 111 return controller_->GetRevealedLock( | 121 return new ImmersiveRevealedLockAsh(controller_->GetRevealedLock( |
| 112 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal)); | 122 ToImmersiveFullscreenControllerAnimateReveal(animate_reveal))); |
| 113 } | 123 } |
| 114 | 124 |
| 115 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( | 125 void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( |
| 116 const gfx::Rect& new_visible_bounds_in_screen) { | 126 const gfx::Rect& new_visible_bounds_in_screen) { |
| 117 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; | 127 find_bar_visible_bounds_in_screen_ = new_visible_bounds_in_screen; |
| 118 } | 128 } |
| 119 | 129 |
| 120 void ImmersiveModeControllerAsh::SetupForTest() { | 130 void ImmersiveModeControllerAsh::SetupForTest() { |
| 121 controller_->SetupForTest(); | 131 controller_->SetupForTest(); |
| 122 } | 132 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 // prevent it from being revealed. | 251 // prevent it from being revealed. |
| 242 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> | 252 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> |
| 243 IsWindowFullscreenForTabOrPending(); | 253 IsWindowFullscreenForTabOrPending(); |
| 244 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( | 254 ash::wm::GetWindowState(native_window_)->set_hide_shelf_when_fullscreen( |
| 245 in_tab_fullscreen); | 255 in_tab_fullscreen); |
| 246 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 256 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
| 247 | 257 |
| 248 if (tab_indicator_visibility_changed) | 258 if (tab_indicator_visibility_changed) |
| 249 LayoutBrowserRootView(); | 259 LayoutBrowserRootView(); |
| 250 } | 260 } |
| OLD | NEW |