blob: aee6e6cd34d26db5dfa5ae6900dead1d3aa3e1b3 [file] [log] [blame]
jdufaulte18aeb22016-08-24 00:46:351// 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 Cooka35a1e22017-04-08 02:33:085#include "ash/system/palette/tools/capture_screen_action.h"
jdufaulte18aeb22016-08-24 00:46:356
Vladislav Kaznacheevfc6220832017-10-12 20:07:387#include "ash/accelerators/accelerator_controller_delegate_classic.h"
8#include "ash/public/cpp/config.h"
estade81c69852016-09-08 21:25:599#include "ash/resources/vector_icons/vector_icons.h"
Vladislav Kaznacheevfc6220832017-10-12 20:07:3810#include "ash/screenshot_delegate.h"
sky07a24d42017-03-09 23:57:3011#include "ash/shell.h"
Vladislav Kaznacheevfc6220832017-10-12 20:07:3812#include "ash/shell_port_classic.h"
jamescooke45f8112017-03-02 16:45:4213#include "ash/strings/grit/ash_strings.h"
James Cooka35a1e22017-04-08 02:33:0814#include "ash/system/palette/palette_ids.h"
jdufaulte18aeb22016-08-24 00:46:3515#include "ui/base/l10n/l10n_util.h"
16
17namespace ash {
18
19CaptureScreenAction::CaptureScreenAction(Delegate* delegate)
20 : CommonPaletteTool(delegate) {}
21
22CaptureScreenAction::~CaptureScreenAction() {}
23
24PaletteGroup CaptureScreenAction::GetGroup() const {
25 return PaletteGroup::ACTION;
26}
27
28PaletteToolId CaptureScreenAction::GetToolId() const {
29 return PaletteToolId::CAPTURE_SCREEN;
30}
31
32void CaptureScreenAction::OnEnable() {
33 CommonPaletteTool::OnEnable();
34
jdufaulte18aeb22016-08-24 00:46:3535 delegate()->DisableTool(GetToolId());
jdufaulta4d53242016-11-10 00:29:1136 delegate()->HidePaletteImmediately();
Vladislav Kaznacheevfc6220832017-10-12 20:07:3837
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();
jdufaulte18aeb22016-08-24 00:46:3548}
49
50views::View* CaptureScreenAction::CreateView() {
51 return CreateDefaultView(
jdufault6546a0d12016-08-26 04:27:5452 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_SCREEN_ACTION));
jdufaulte18aeb22016-08-24 00:46:3553}
54
estade81c69852016-09-08 21:25:5955const gfx::VectorIcon& CaptureScreenAction::GetPaletteIcon() const {
56 return kPaletteActionCaptureScreenIcon;
jdufaulte18aeb22016-08-24 00:46:3557}
58
59} // namespace ash