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 | |
estade | 81c6985 | 2016-09-08 21:25:59 | [diff] [blame] | 7 | #include "ash/resources/vector_icons/vector_icons.h" |
sky | 07a24d4 | 2017-03-09 23:57:30 | [diff] [blame] | 8 | #include "ash/shell.h" |
jamescook | e45f811 | 2017-03-02 16:45:42 | [diff] [blame] | 9 | #include "ash/strings/grit/ash_strings.h" |
James Cook | a35a1e2 | 2017-04-08 02:33:08 | [diff] [blame] | 10 | #include "ash/system/palette/palette_ids.h" |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 11 | #include "ash/utility/screenshot_controller.h" |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 12 | #include "ui/base/l10n/l10n_util.h" |
| 13 | |
| 14 | namespace ash { |
| 15 | |
| 16 | CaptureScreenAction::CaptureScreenAction(Delegate* delegate) |
| 17 | : CommonPaletteTool(delegate) {} |
| 18 | |
Chris Watkins | c24daf6 | 2017-11-28 03:43:09 | [diff] [blame^] | 19 | CaptureScreenAction::~CaptureScreenAction() = default; |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 20 | |
| 21 | PaletteGroup CaptureScreenAction::GetGroup() const { |
| 22 | return PaletteGroup::ACTION; |
| 23 | } |
| 24 | |
| 25 | PaletteToolId CaptureScreenAction::GetToolId() const { |
| 26 | return PaletteToolId::CAPTURE_SCREEN; |
| 27 | } |
| 28 | |
| 29 | void CaptureScreenAction::OnEnable() { |
| 30 | CommonPaletteTool::OnEnable(); |
| 31 | |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 32 | delegate()->DisableTool(GetToolId()); |
jdufault | a4d5324 | 2016-11-10 00:29:11 | [diff] [blame] | 33 | delegate()->HidePaletteImmediately(); |
Vladislav Kaznacheev | fc622083 | 2017-10-12 20:07:38 | [diff] [blame] | 34 | |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 35 | Shell::Get()->screenshot_controller()->TakeScreenshotForAllRootWindows(); |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | views::View* CaptureScreenAction::CreateView() { |
| 39 | return CreateDefaultView( |
jdufault | 6546a0d1 | 2016-08-26 04:27:54 | [diff] [blame] | 40 | l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_SCREEN_ACTION)); |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 41 | } |
| 42 | |
estade | 81c6985 | 2016-09-08 21:25:59 | [diff] [blame] | 43 | const gfx::VectorIcon& CaptureScreenAction::GetPaletteIcon() const { |
| 44 | return kPaletteActionCaptureScreenIcon; |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | } // namespace ash |