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 // TODO(jdufault): Convert ToastData to use base::string16 so we can properly |
| 24 // localize the toast messages and land the final strings. See crbug.com/634558. |
| 25 const char kToastMessage[] = "Select a region"; |
| 26 const char kToastDismiss[] = "Dismiss"; |
| 27 |
| 28 } // namespace |
| 29 |
| 30 CaptureRegionAction::CaptureRegionAction(Delegate* delegate) |
| 31 : CommonPaletteTool(delegate) {} |
| 32 |
| 33 CaptureRegionAction::~CaptureRegionAction() {} |
| 34 |
| 35 PaletteGroup CaptureRegionAction::GetGroup() const { |
| 36 return PaletteGroup::ACTION; |
| 37 } |
| 38 |
| 39 PaletteToolId CaptureRegionAction::GetToolId() const { |
| 40 return PaletteToolId::CAPTURE_REGION; |
| 41 } |
| 42 |
| 43 void CaptureRegionAction::OnEnable() { |
| 44 CommonPaletteTool::OnEnable(); |
| 45 |
| 46 ToastData toast(kToastId, kToastMessage, kToastDurationMs, kToastDismiss); |
| 47 ash::WmShell::Get()->toast_manager()->Show(toast); |
| 48 |
| 49 WmShell::Get()->palette_delegate()->TakePartialScreenshot(); |
| 50 delegate()->DisableTool(GetToolId()); |
| 51 delegate()->HidePalette(); |
| 52 } |
| 53 |
| 54 views::View* CaptureRegionAction::CreateView() { |
| 55 return CreateDefaultView( |
| 56 l10n_util::GetStringUTF16(IDS_ASH_PALETTE_CAPTURE_REGION_ACTION)); |
| 57 } |
| 58 |
| 59 gfx::VectorIconId CaptureRegionAction::GetPaletteIconId() { |
| 60 return gfx::VectorIconId::PALETTE_ACTION_CAPTURE_REGION; |
| 61 } |
| 62 |
| 63 } // namespace ash |
OLD | NEW |