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

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

Issue 1909873002: Allow taking screen shot of a non child window which has delegate to paint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 26 matching lines...) Expand all
37 #include "ash/shell_window_ids.h" 37 #include "ash/shell_window_ids.h"
38 #include "ash/system/brightness_control_delegate.h" 38 #include "ash/system/brightness_control_delegate.h"
39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" 39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
40 #include "ash/system/status_area_widget.h" 40 #include "ash/system/status_area_widget.h"
41 #include "ash/system/system_notifier.h" 41 #include "ash/system/system_notifier.h"
42 #include "ash/system/tray/system_tray.h" 42 #include "ash/system/tray/system_tray.h"
43 #include "ash/system/tray/system_tray_delegate.h" 43 #include "ash/system/tray/system_tray_delegate.h"
44 #include "ash/system/tray/system_tray_notifier.h" 44 #include "ash/system/tray/system_tray_notifier.h"
45 #include "ash/system/web_notification/web_notification_tray.h" 45 #include "ash/system/web_notification/web_notification_tray.h"
46 #include "ash/touch/touch_hud_debug.h" 46 #include "ash/touch/touch_hud_debug.h"
47 #include "ash/utility/partial_screenshot_controller.h" 47 #include "ash/utility/screenshot_controller.h"
48 #include "ash/volume_control_delegate.h" 48 #include "ash/volume_control_delegate.h"
49 #include "ash/wm/common/window_state.h" 49 #include "ash/wm/common/window_state.h"
50 #include "ash/wm/common/wm_event.h" 50 #include "ash/wm/common/wm_event.h"
51 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 51 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
52 #include "ash/wm/mru_window_tracker.h" 52 #include "ash/wm/mru_window_tracker.h"
53 #include "ash/wm/overview/window_selector_controller.h" 53 #include "ash/wm/overview/window_selector_controller.h"
54 #include "ash/wm/power_button_controller.h" 54 #include "ash/wm/power_button_controller.h"
55 #include "ash/wm/window_cycle_controller.h" 55 #include "ash/wm/window_cycle_controller.h"
56 #include "ash/wm/window_state_aura.h" 56 #include "ash/wm/window_state_aura.h"
57 #include "ash/wm/window_util.h" 57 #include "ash/wm/window_util.h"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return ime_control_delegate && 453 return ime_control_delegate &&
454 ime_control_delegate->CanSwitchIme(accelerator); 454 ime_control_delegate->CanSwitchIme(accelerator);
455 } 455 }
456 456
457 void HandleSwitchIme(ImeControlDelegate* ime_control_delegate, 457 void HandleSwitchIme(ImeControlDelegate* ime_control_delegate,
458 const ui::Accelerator& accelerator) { 458 const ui::Accelerator& accelerator) {
459 base::RecordAction(UserMetricsAction("Accel_Switch_Ime")); 459 base::RecordAction(UserMetricsAction("Accel_Switch_Ime"));
460 ime_control_delegate->HandleSwitchIme(accelerator); 460 ime_control_delegate->HandleSwitchIme(accelerator);
461 } 461 }
462 462
463 void HandleTakeActiveWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { 463 void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) {
464 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); 464 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot"));
465 aura::Window* active_window = wm::GetActiveWindow();
466 if (!active_window)
467 return;
468 DCHECK(screenshot_delegate); 465 DCHECK(screenshot_delegate);
469 if (screenshot_delegate->CanTakeScreenshot()) 466 Shell::GetInstance()->screenshot_controller()->StartWindowScreenshotSession(
470 screenshot_delegate->HandleTakeWindowScreenshot(active_window); 467 screenshot_delegate);
471 } 468 }
472 469
473 void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) { 470 void HandleTakePartialScreenshot(ScreenshotDelegate* screenshot_delegate) {
474 base::RecordAction(UserMetricsAction("Accel_Take_Partial_Screenshot")); 471 base::RecordAction(UserMetricsAction("Accel_Take_Partial_Screenshot"));
475 DCHECK(screenshot_delegate); 472 DCHECK(screenshot_delegate);
476 Shell::GetInstance() 473 Shell::GetInstance()->screenshot_controller()->StartPartialScreenshotSession(
477 ->partial_screenshot_controller() 474 screenshot_delegate);
478 ->StartPartialScreenshotSession(screenshot_delegate);
479 } 475 }
480 476
481 void HandleTakeScreenshot(ScreenshotDelegate* screenshot_delegate) { 477 void HandleTakeScreenshot(ScreenshotDelegate* screenshot_delegate) {
482 base::RecordAction(UserMetricsAction("Accel_Take_Screenshot")); 478 base::RecordAction(UserMetricsAction("Accel_Take_Screenshot"));
483 DCHECK(screenshot_delegate); 479 DCHECK(screenshot_delegate);
484 if (screenshot_delegate->CanTakeScreenshot()) 480 if (screenshot_delegate->CanTakeScreenshot())
485 screenshot_delegate->HandleTakeScreenshotForAllRootWindows(); 481 screenshot_delegate->HandleTakeScreenshotForAllRootWindows();
486 } 482 }
487 483
488 bool CanHandleToggleAppList(const ui::Accelerator& accelerator, 484 bool CanHandleToggleAppList(const ui::Accelerator& accelerator,
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 case NEW_TAB: 1079 case NEW_TAB:
1084 case NEW_WINDOW: 1080 case NEW_WINDOW:
1085 case OPEN_FEEDBACK_PAGE: 1081 case OPEN_FEEDBACK_PAGE:
1086 case PRINT_UI_HIERARCHIES: 1082 case PRINT_UI_HIERARCHIES:
1087 case RESTORE_TAB: 1083 case RESTORE_TAB:
1088 case ROTATE_SCREEN: 1084 case ROTATE_SCREEN:
1089 case ROTATE_WINDOW: 1085 case ROTATE_WINDOW:
1090 case SHOW_KEYBOARD_OVERLAY: 1086 case SHOW_KEYBOARD_OVERLAY:
1091 case SHOW_SYSTEM_TRAY_BUBBLE: 1087 case SHOW_SYSTEM_TRAY_BUBBLE:
1092 case SHOW_TASK_MANAGER: 1088 case SHOW_TASK_MANAGER:
1093 case TAKE_ACTIVE_WINDOW_SCREENSHOT: 1089 case TAKE_WINDOW_SCREENSHOT:
1094 case TAKE_PARTIAL_SCREENSHOT: 1090 case TAKE_PARTIAL_SCREENSHOT:
1095 case TAKE_SCREENSHOT: 1091 case TAKE_SCREENSHOT:
1096 case TOGGLE_FULLSCREEN: 1092 case TOGGLE_FULLSCREEN:
1097 case TOGGLE_MAXIMIZED: 1093 case TOGGLE_MAXIMIZED:
1098 case TOGGLE_OVERVIEW: 1094 case TOGGLE_OVERVIEW:
1099 case WINDOW_MINIMIZE: 1095 case WINDOW_MINIMIZE:
1100 #if defined(OS_CHROMEOS) 1096 #if defined(OS_CHROMEOS)
1101 case BRIGHTNESS_DOWN: 1097 case BRIGHTNESS_DOWN:
1102 case BRIGHTNESS_UP: 1098 case BRIGHTNESS_UP:
1103 case DISABLE_GPU_WATCHDOG: 1099 case DISABLE_GPU_WATCHDOG:
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 break; 1251 break;
1256 case SHOW_SYSTEM_TRAY_BUBBLE: 1252 case SHOW_SYSTEM_TRAY_BUBBLE:
1257 HandleShowSystemTrayBubble(); 1253 HandleShowSystemTrayBubble();
1258 break; 1254 break;
1259 case SHOW_TASK_MANAGER: 1255 case SHOW_TASK_MANAGER:
1260 HandleShowTaskManager(); 1256 HandleShowTaskManager();
1261 break; 1257 break;
1262 case SWITCH_IME: 1258 case SWITCH_IME:
1263 HandleSwitchIme(ime_control_delegate_.get(), accelerator); 1259 HandleSwitchIme(ime_control_delegate_.get(), accelerator);
1264 break; 1260 break;
1265 case TAKE_ACTIVE_WINDOW_SCREENSHOT: 1261 case TAKE_WINDOW_SCREENSHOT:
1266 HandleTakeActiveWindowScreenshot(screenshot_delegate_.get()); 1262 HandleTakeWindowScreenshot(screenshot_delegate_.get());
1267 break; 1263 break;
1268 case TAKE_PARTIAL_SCREENSHOT: 1264 case TAKE_PARTIAL_SCREENSHOT:
1269 HandleTakePartialScreenshot(screenshot_delegate_.get()); 1265 HandleTakePartialScreenshot(screenshot_delegate_.get());
1270 break; 1266 break;
1271 case TAKE_SCREENSHOT: 1267 case TAKE_SCREENSHOT:
1272 HandleTakeScreenshot(screenshot_delegate_.get()); 1268 HandleTakeScreenshot(screenshot_delegate_.get());
1273 break; 1269 break;
1274 case TOGGLE_APP_LIST: 1270 case TOGGLE_APP_LIST:
1275 HandleToggleAppList(accelerator); 1271 HandleToggleAppList(accelerator);
1276 break; 1272 break;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 } 1439 }
1444 1440
1445 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1441 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1446 std::unique_ptr<KeyboardBrightnessControlDelegate> 1442 std::unique_ptr<KeyboardBrightnessControlDelegate>
1447 keyboard_brightness_control_delegate) { 1443 keyboard_brightness_control_delegate) {
1448 keyboard_brightness_control_delegate_ = 1444 keyboard_brightness_control_delegate_ =
1449 std::move(keyboard_brightness_control_delegate); 1445 std::move(keyboard_brightness_control_delegate);
1450 } 1446 }
1451 1447
1452 } // namespace ash 1448 } // 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