jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
James Cook | a35a1e2 | 2017-04-08 02:33:08 | [diff] [blame] | 5 | #include "ash/system/palette/tools/capture_screen_action.h" |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 6 | |
Vladislav Kaznacheev | fc622083 | 2017-10-12 20:07:38 | [diff] [blame^] | 7 | #include "ash/accelerators/accelerator_controller_delegate_classic.h" |
| 8 | #include "ash/public/cpp/config.h" |
estade | 81c6985 | 2016-09-08 21:25:59 | [diff] [blame] | 9 | #include "ash/resources/vector_icons/vector_icons.h" |
Vladislav Kaznacheev | fc622083 | 2017-10-12 20:07:38 | [diff] [blame^] | 10 | #include "ash/screenshot_delegate.h" |
sky | 07a24d4 | 2017-03-09 23:57:30 | [diff] [blame] | 11 | #include "ash/shell.h" |
Vladislav Kaznacheev | fc622083 | 2017-10-12 20:07:38 | [diff] [blame^] | 12 | #include "ash/shell_port_classic.h" |
jamescook | e45f811 | 2017-03-02 16:45:42 | [diff] [blame] | 13 | #include "ash/strings/grit/ash_strings.h" |
James Cook | a35a1e2 | 2017-04-08 02:33:08 | [diff] [blame] | 14 | #include "ash/system/palette/palette_ids.h" |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 15 | #include "ui/base/l10n/l10n_util.h" |
| 16 | |
| 17 | namespace ash { |
| 18 | |
| 19 | CaptureScreenAction::CaptureScreenAction(Delegate* delegate) |
| 20 | : CommonPaletteTool(delegate) {} |
| 21 | |
| 22 | CaptureScreenAction::~CaptureScreenAction() {} |
| 23 | |
| 24 | PaletteGroup CaptureScreenAction::GetGroup() const { |
| 25 | return PaletteGroup::ACTION; |
| 26 | } |
| 27 | |
| 28 | PaletteToolId CaptureScreenAction::GetToolId() const { |
| 29 | return PaletteToolId::CAPTURE_SCREEN; |
| 30 | } |
| 31 | |
| 32 | void CaptureScreenAction::OnEnable() { |
| 33 | CommonPaletteTool::OnEnable(); |
| 34 | |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 35 | delegate()->DisableTool(GetToolId()); |
jdufault | a4d5324 | 2016-11-10 00:29:11 | [diff] [blame] | 36 | delegate()->HidePaletteImmediately(); |
Vladislav Kaznacheev | fc622083 | 2017-10-12 20:07:38 | [diff] [blame^] | 37 | |
| 38 | if (Shell::GetAshConfig() != Config::CLASSIC) { |
| 39 | // TODO(kaznacheev): Support MASH once http://crbug.com/557397 is fixed. |
| 40 | NOTIMPLEMENTED(); |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | ShellPortClassic::Get() |
| 45 | ->accelerator_controller_delegate() |
| 46 | ->screenshot_delegate() |
| 47 | ->HandleTakeScreenshotForAllRootWindows(); |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | views::View* CaptureScreenAction::CreateView() { |
| 51 | return CreateDefaultView( |
jdufault | 6546a0d1 | 2016-08-26 04:27:54 | [diff] [blame] | 52 | l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_SCREEN_ACTION)); |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 53 | } |
| 54 | |
estade | 81c6985 | 2016-09-08 21:25:59 | [diff] [blame] | 55 | const gfx::VectorIcon& CaptureScreenAction::GetPaletteIcon() const { |
| 56 | return kPaletteActionCaptureScreenIcon; |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | } // namespace ash |