Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: athena/home/home_card_impl.cc

Issue 601333002: ESC accelerator and consistent overview mode for Athena homecard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviews, update unit tests Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | athena/home/home_card_unittest.cc » ('j') | athena/wm/public/window_manager.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | athena/home/home_card_unittest.cc » ('j') | athena/wm/public/window_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698