OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/home/home_card_impl.h" | 5 #include "athena/home/home_card_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "athena/env/public/athena_env.h" | 10 #include "athena/env/public/athena_env.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 gesture_delegate_, | 190 gesture_delegate_, |
191 GetWidget()->GetNativeWindow()->GetRootWindow()->bounds())); | 191 GetWidget()->GetNativeWindow()->GetRootWindow()->bounds())); |
192 } | 192 } |
193 | 193 |
194 if (gesture_manager_) | 194 if (gesture_manager_) |
195 gesture_manager_->ProcessGestureEvent(event); | 195 gesture_manager_->ProcessGestureEvent(event); |
196 } | 196 } |
197 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 197 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
198 if (HomeCard::Get()->GetState() == HomeCard::VISIBLE_MINIMIZED && | 198 if (HomeCard::Get()->GetState() == HomeCard::VISIBLE_MINIMIZED && |
199 event.IsLeftMouseButton() && event.GetClickCount() == 1) { | 199 event.IsLeftMouseButton() && event.GetClickCount() == 1) { |
200 athena::WindowManager::Get()->ToggleOverview(); | 200 athena::WindowManager::Get()->ActivateOverview(false); |
201 return true; | 201 return true; |
202 } | 202 } |
203 return false; | 203 return false; |
204 } | 204 } |
205 | 205 |
206 private: | 206 private: |
207 void UpdateShadow(bool should_show) { | 207 void UpdateShadow(bool should_show) { |
208 wm::SetShadowType( | 208 wm::SetShadowType( |
209 GetWidget()->GetNativeWindow(), | 209 GetWidget()->GetNativeWindow(), |
210 should_show ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE); | 210 should_show ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 360 } |
361 | 361 |
362 bool HomeCardImpl::IsCommandEnabled(int command_id) const { | 362 bool HomeCardImpl::IsCommandEnabled(int command_id) const { |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 bool HomeCardImpl::OnAcceleratorFired(int command_id, | 366 bool HomeCardImpl::OnAcceleratorFired(int command_id, |
367 const ui::Accelerator& accelerator) { | 367 const ui::Accelerator& accelerator) { |
368 DCHECK_EQ(COMMAND_SHOW_HOME_CARD, command_id); | 368 DCHECK_EQ(COMMAND_SHOW_HOME_CARD, command_id); |
369 | 369 |
370 if (state_ == VISIBLE_CENTERED && original_state_ != VISIBLE_BOTTOM) | 370 if (state_ == VISIBLE_CENTERED && original_state_ != VISIBLE_BOTTOM) { |
371 SetState(VISIBLE_MINIMIZED); | 371 SetState(VISIBLE_MINIMIZED); |
372 else if (state_ == VISIBLE_MINIMIZED) | 372 WindowManager::Get()->ActivateOverview(false); |
| 373 } else if (state_ == VISIBLE_MINIMIZED) { |
373 SetState(VISIBLE_CENTERED); | 374 SetState(VISIBLE_CENTERED); |
| 375 WindowManager::Get()->ActivateOverview(true); |
| 376 } |
374 return true; | 377 return true; |
375 } | 378 } |
376 | 379 |
377 void HomeCardImpl::OnGestureEnded(State final_state, bool is_fling) { | 380 void HomeCardImpl::OnGestureEnded(State final_state, bool is_fling) { |
378 home_card_view_->ClearGesture(); | 381 home_card_view_->ClearGesture(); |
379 if (state_ != final_state && | 382 if (state_ != final_state && |
380 (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) { | 383 (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) { |
381 SetState(final_state); | 384 SetState(final_state); |
382 WindowManager::Get()->ToggleOverview(); | 385 WindowManager::Get()->ToggleOverview(); |
383 } else { | 386 } else { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 instance = NULL; | 453 instance = NULL; |
451 } | 454 } |
452 | 455 |
453 // static | 456 // static |
454 HomeCard* HomeCard::Get() { | 457 HomeCard* HomeCard::Get() { |
455 DCHECK(instance); | 458 DCHECK(instance); |
456 return instance; | 459 return instance; |
457 } | 460 } |
458 | 461 |
459 } // namespace athena | 462 } // namespace athena |
OLD | NEW |