| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/first_run/desktop_cleaner.h" | 5 #include "ash/first_run/desktop_cleaner.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
| 10 #include "ui/aura/window_observer.h" | 10 #include "ui/aura/window_observer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } else { | 50 } else { |
| 51 container_->Show(); | 51 container_->Show(); |
| 52 } | 52 } |
| 53 ui::Layer* layer = container_->layer(); | 53 ui::Layer* layer = container_->layer(); |
| 54 ui::ScopedLayerAnimationSettings animation_settings(layer->GetAnimator()); | 54 ui::ScopedLayerAnimationSettings animation_settings(layer->GetAnimator()); |
| 55 layer->SetOpacity(1.0); | 55 layer->SetOpacity(1.0); |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // Overriden from ui::ImplicitAnimationObserver. | 59 // Overriden from ui::ImplicitAnimationObserver. |
| 60 virtual void OnImplicitAnimationsCompleted() OVERRIDE { | 60 virtual void OnImplicitAnimationsCompleted() override { |
| 61 container_->Hide(); | 61 container_->Hide(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Overriden from aura::WindowObserver. | 64 // Overriden from aura::WindowObserver. |
| 65 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { | 65 virtual void OnWindowDestroying(aura::Window* window) override { |
| 66 DCHECK(window == container_); | 66 DCHECK(window == container_); |
| 67 container_ = NULL; | 67 container_ = NULL; |
| 68 } | 68 } |
| 69 | 69 |
| 70 const bool container_was_hidden_; | 70 const bool container_was_hidden_; |
| 71 aura::Window* container_; | 71 aura::Window* container_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(ContainerHider); | 73 DISALLOW_COPY_AND_ASSIGN(ContainerHider); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class NotificationBlocker : public message_center::NotificationBlocker { | 76 class NotificationBlocker : public message_center::NotificationBlocker { |
| 77 public: | 77 public: |
| 78 NotificationBlocker() | 78 NotificationBlocker() |
| 79 : message_center::NotificationBlocker( | 79 : message_center::NotificationBlocker( |
| 80 message_center::MessageCenter::Get()) { | 80 message_center::MessageCenter::Get()) { |
| 81 NotifyBlockingStateChanged(); | 81 NotifyBlockingStateChanged(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual ~NotificationBlocker() {}; | 84 virtual ~NotificationBlocker() {}; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // Overriden from message_center::NotificationBlocker. | 87 // Overriden from message_center::NotificationBlocker. |
| 88 virtual bool ShouldShowNotificationAsPopup( | 88 virtual bool ShouldShowNotificationAsPopup( |
| 89 const message_center::NotifierId& notifier_id) const OVERRIDE { | 89 const message_center::NotifierId& notifier_id) const override { |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(NotificationBlocker); | 93 DISALLOW_COPY_AND_ASSIGN(NotificationBlocker); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 DesktopCleaner::DesktopCleaner() { | 96 DesktopCleaner::DesktopCleaner() { |
| 97 // TODO(dzhioev): Add support for secondary displays. | 97 // TODO(dzhioev): Add support for secondary displays. |
| 98 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); | 98 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
| 99 for (size_t i = 0; i < arraysize(kContainerIdsToHide); ++i) { | 99 for (size_t i = 0; i < arraysize(kContainerIdsToHide); ++i) { |
| 100 aura::Window* container = | 100 aura::Window* container = |
| 101 Shell::GetContainer(root_window, kContainerIdsToHide[i]); | 101 Shell::GetContainer(root_window, kContainerIdsToHide[i]); |
| 102 container_hiders_.push_back(make_linked_ptr(new ContainerHider(container))); | 102 container_hiders_.push_back(make_linked_ptr(new ContainerHider(container))); |
| 103 } | 103 } |
| 104 notification_blocker_.reset(new NotificationBlocker()); | 104 notification_blocker_.reset(new NotificationBlocker()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 DesktopCleaner::~DesktopCleaner() {} | 107 DesktopCleaner::~DesktopCleaner() {} |
| 108 | 108 |
| 109 // static | 109 // static |
| 110 std::vector<int> DesktopCleaner::GetContainersToHideForTest() { | 110 std::vector<int> DesktopCleaner::GetContainersToHideForTest() { |
| 111 return std::vector<int>(kContainerIdsToHide, | 111 return std::vector<int>(kContainerIdsToHide, |
| 112 kContainerIdsToHide + arraysize(kContainerIdsToHide)); | 112 kContainerIdsToHide + arraysize(kContainerIdsToHide)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace ash | 115 } // namespace ash |
| 116 | 116 |
| OLD | NEW |