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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 10414064: Handle more browser commands in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/caps_lock_delegate.h" 9 #include "ash/caps_lock_delegate.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #endif 74 #endif
75 75
76 bool HandleExit() { 76 bool HandleExit() {
77 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); 77 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate();
78 if (!delegate) 78 if (!delegate)
79 return false; 79 return false;
80 delegate->Exit(); 80 delegate->Exit();
81 return true; 81 return true;
82 } 82 }
83 83
84 bool HandleNewTab() {
85 ash::Shell::GetInstance()->delegate()->NewTab();
86 return true;
87 }
88
84 bool HandleNewWindow(bool is_incognito) { 89 bool HandleNewWindow(bool is_incognito) {
85 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); 90 ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate();
86 if (!delegate) 91 if (!delegate)
87 return false; 92 return false;
88 delegate->NewWindow(is_incognito); 93 delegate->NewWindow(is_incognito);
89 return true; 94 return true;
90 } 95 }
91 96
97 bool HandleOpenBookmarkManager() {
Ben Goodger (Google) 2012/05/23 00:14:14 ash shouldn't know anything about browser commands
98 ash::Shell::GetInstance()->delegate()->OpenBookmarkManager();
99 return true;
100 }
101
102 bool HandleOpenClearBrowsingData() {
Ben Goodger (Google) 2012/05/23 00:14:14 or this
103 ash::Shell::GetInstance()->delegate()->OpenClearBrowsingData();
104 return true;
105 }
106
107 bool HandleOpenDownloads() {
Ben Goodger (Google) 2012/05/23 00:14:14 or this
108 ash::Shell::GetInstance()->delegate()->OpenDownloads();
109 return true;
110 }
111
112 bool HandleOpenHelpPage() {
Ben Goodger (Google) 2012/05/23 00:14:14 or this
113 ash::Shell::GetInstance()->delegate()->OpenHelpPage();
114 return true;
115 }
116
117 bool HandleOpenHistory() {
118 ash::Shell::GetInstance()->delegate()->OpenHistory();
119 return true;
120 }
121
122 bool HandleOpenHome() {
123 ash::Shell::GetInstance()->delegate()->OpenHome();
124 return true;
125 }
126
127 bool HandleRestoreTab() {
128 ash::Shell::GetInstance()->delegate()->RestoreTab();
129 return true;
130 }
131
132 bool HandleShowTaskManager() {
133 ash::Shell::GetInstance()->delegate()->ShowTaskManager();
134 return true;
135 }
136
92 // Rotates the default window container. 137 // Rotates the default window container.
93 bool HandleRotateWindows() { 138 bool HandleRotateWindows() {
94 aura::Window* target = ash::Shell::GetInstance()->GetContainer( 139 aura::Window* target = ash::Shell::GetInstance()->GetContainer(
95 ash::internal::kShellWindowId_DefaultContainer); 140 ash::internal::kShellWindowId_DefaultContainer);
96 scoped_ptr<ui::LayerAnimationSequence> screen_rotation( 141 scoped_ptr<ui::LayerAnimationSequence> screen_rotation(
97 new ui::LayerAnimationSequence(new ui::ScreenRotation(360))); 142 new ui::LayerAnimationSequence(new ui::ScreenRotation(360)));
98 target->layer()->GetAnimator()->StartAnimation( 143 target->layer()->GetAnimator()->StartAnimation(
99 screen_rotation.release()); 144 screen_rotation.release());
100 return true; 145 return true;
101 } 146 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return HandleFileManager(); 343 return HandleFileManager();
299 case OPEN_CROSH: 344 case OPEN_CROSH:
300 return HandleCrosh(); 345 return HandleCrosh();
301 case TOGGLE_SPOKEN_FEEDBACK: 346 case TOGGLE_SPOKEN_FEEDBACK:
302 return HandleToggleSpokenFeedback(); 347 return HandleToggleSpokenFeedback();
303 #endif 348 #endif
304 case EXIT: 349 case EXIT:
305 return HandleExit(); 350 return HandleExit();
306 case NEW_INCOGNITO_WINDOW: 351 case NEW_INCOGNITO_WINDOW:
307 return HandleNewWindow(true /* is_incognito */); 352 return HandleNewWindow(true /* is_incognito */);
353 case NEW_TAB:
354 return HandleNewTab();
308 case NEW_WINDOW: 355 case NEW_WINDOW:
309 return HandleNewWindow(false /* is_incognito */); 356 return HandleNewWindow(false /* is_incognito */);
357 case OPEN_BOOKMARK_MANAGER:
358 return HandleOpenBookmarkManager();
359 case OPEN_CLEAR_BROWSING_DATA:
360 return HandleOpenClearBrowsingData();
361 case OPEN_DOWNLOADS:
362 return HandleOpenDownloads();
363 case OPEN_HELP_PAGE:
364 return HandleOpenHelpPage();
365 case OPEN_HISTORY:
366 return HandleOpenHistory();
367 case OPEN_HOME:
368 return HandleOpenHome();
369 case RESTORE_TAB:
370 return HandleRestoreTab();
310 case TAKE_SCREENSHOT: 371 case TAKE_SCREENSHOT:
311 if (screenshot_delegate_.get()) { 372 if (screenshot_delegate_.get()) {
312 aura::RootWindow* root_window = Shell::GetRootWindow(); 373 aura::RootWindow* root_window = Shell::GetRootWindow();
313 screenshot_delegate_->HandleTakeScreenshot(root_window); 374 screenshot_delegate_->HandleTakeScreenshot(root_window);
314 } 375 }
315 // Return true to prevent propagation of the key event. 376 // Return true to prevent propagation of the key event.
316 return true; 377 return true;
317 case TAKE_PARTIAL_SCREENSHOT: 378 case TAKE_PARTIAL_SCREENSHOT:
318 if (screenshot_delegate_.get()) 379 if (screenshot_delegate_.get())
319 ash::Shell::GetInstance()->delegate()-> 380 ash::Shell::GetInstance()->delegate()->
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 case SHOW_KEYBOARD_OVERLAY: 423 case SHOW_KEYBOARD_OVERLAY:
363 ash::Shell::GetInstance()->delegate()->ShowKeyboardOverlay(this); 424 ash::Shell::GetInstance()->delegate()->ShowKeyboardOverlay(this);
364 break; 425 break;
365 case SHOW_OAK: 426 case SHOW_OAK:
366 if (CommandLine::ForCurrentProcess()->HasSwitch( 427 if (CommandLine::ForCurrentProcess()->HasSwitch(
367 switches::kAshEnableOak)) { 428 switches::kAshEnableOak)) {
368 oak::ShowOakWindow(); 429 oak::ShowOakWindow();
369 return true; 430 return true;
370 } 431 }
371 break; 432 break;
433 case SHOW_TASK_MANAGER:
434 return HandleShowTaskManager();
372 case NEXT_IME: 435 case NEXT_IME:
373 if (ime_control_delegate_.get()) 436 if (ime_control_delegate_.get())
374 return ime_control_delegate_->HandleNextIme(); 437 return ime_control_delegate_->HandleNextIme();
375 break; 438 break;
376 case PREVIOUS_IME: 439 case PREVIOUS_IME:
377 if (ime_control_delegate_.get()) 440 if (ime_control_delegate_.get())
378 return ime_control_delegate_->HandlePreviousIme(); 441 return ime_control_delegate_->HandlePreviousIme();
379 break; 442 break;
380 case SWITCH_IME: 443 case SWITCH_IME:
381 if (ime_control_delegate_.get()) 444 if (ime_control_delegate_.get())
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // Then set this one as active. 566 // Then set this one as active.
504 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); 567 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index);
505 } 568 }
506 } 569 }
507 570
508 bool AcceleratorController::CanHandleAccelerators() const { 571 bool AcceleratorController::CanHandleAccelerators() const {
509 return true; 572 return true;
510 } 573 }
511 574
512 } // namespace ash 575 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698