Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: ash/common/system/chromeos/palette/tools/capture_region_action.cc

Issue 2269383002: Magnifier border is now more visible on light backgrounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698