| OLD | NEW |
| (Empty) |
| 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 | |
| 5 #include "ash/common/system/chromeos/palette/tools/capture_region_action.h" | |
| 6 | |
| 7 #include "ash/common/accelerators/accelerator_controller.h" | |
| 8 #include "ash/common/palette_delegate.h" | |
| 9 #include "ash/common/system/chromeos/palette/palette_ids.h" | |
| 10 #include "ash/common/system/toast/toast_data.h" | |
| 11 #include "ash/common/system/toast/toast_manager.h" | |
| 12 #include "ash/common/wm_shell.h" | |
| 13 #include "grit/ash_strings.h" | |
| 14 #include "ui/base/l10n/l10n_util.h" | |
| 15 | |
| 16 namespace ash { | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 const char kToastId[] = "palette_capture_region"; | |
| 21 const int kToastDurationMs = 2500; | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 CaptureRegionAction::CaptureRegionAction(Delegate* delegate) | |
| 26 : CommonPaletteTool(delegate) {} | |
| 27 | |
| 28 CaptureRegionAction::~CaptureRegionAction() {} | |
| 29 | |
| 30 PaletteGroup CaptureRegionAction::GetGroup() const { | |
| 31 return PaletteGroup::ACTION; | |
| 32 } | |
| 33 | |
| 34 PaletteToolId CaptureRegionAction::GetToolId() const { | |
| 35 return PaletteToolId::CAPTURE_REGION; | |
| 36 } | |
| 37 | |
| 38 void CaptureRegionAction::OnEnable() { | |
| 39 CommonPaletteTool::OnEnable(); | |
| 40 | |
| 41 ToastData toast(kToastId, l10n_util::GetStringUTF16( | |
| 42 IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_TOAST), | |
| 43 kToastDurationMs, base::string16()); | |
| 44 ash::WmShell::Get()->toast_manager()->Show(toast); | |
| 45 | |
| 46 WmShell::Get()->palette_delegate()->TakePartialScreenshot(); | |
| 47 delegate()->DisableTool(GetToolId()); | |
| 48 delegate()->HidePalette(); | |
| 49 } | |
| 50 | |
| 51 views::View* CaptureRegionAction::CreateView() { | |
| 52 return CreateDefaultView( | |
| 53 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION)); | |
| 54 } | |
| 55 | |
| 56 gfx::VectorIconId CaptureRegionAction::GetPaletteIconId() { | |
| 57 return gfx::VectorIconId::PALETTE_ACTION_CAPTURE_REGION; | |
| 58 } | |
| 59 | |
| 60 } // namespace ash | |
| OLD | NEW |