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

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

Issue 2738133003: Promotes a handful of members from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/palette/tools/capture_region_mode.h" 5 #include "ash/common/system/chromeos/palette/tools/capture_region_mode.h"
6 6
7 #include "ash/common/accelerators/accelerator_controller.h" 7 #include "ash/common/accelerators/accelerator_controller.h"
8 #include "ash/common/palette_delegate.h" 8 #include "ash/common/palette_delegate.h"
9 #include "ash/common/system/chromeos/palette/palette_ids.h" 9 #include "ash/common/system/chromeos/palette/palette_ids.h"
10 #include "ash/common/system/toast/toast_data.h" 10 #include "ash/common/system/toast/toast_data.h"
11 #include "ash/common/system/toast/toast_manager.h" 11 #include "ash/common/system/toast/toast_manager.h"
12 #include "ash/common/wm_shell.h"
13 #include "ash/resources/vector_icons/vector_icons.h" 12 #include "ash/resources/vector_icons/vector_icons.h"
13 #include "ash/shell.h"
14 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 namespace ash { 17 namespace ash {
18 18
19 namespace { 19 namespace {
20 20
21 const char kToastId[] = "palette_capture_region"; 21 const char kToastId[] = "palette_capture_region";
22 const int kToastDurationMs = 2500; 22 const int kToastDurationMs = 2500;
23 23
(...skipping 15 matching lines...) Expand all
39 const gfx::VectorIcon& CaptureRegionMode::GetActiveTrayIcon() const { 39 const gfx::VectorIcon& CaptureRegionMode::GetActiveTrayIcon() const {
40 return kPaletteTrayIconCaptureRegionIcon; 40 return kPaletteTrayIconCaptureRegionIcon;
41 } 41 }
42 42
43 void CaptureRegionMode::OnEnable() { 43 void CaptureRegionMode::OnEnable() {
44 CommonPaletteTool::OnEnable(); 44 CommonPaletteTool::OnEnable();
45 45
46 ToastData toast(kToastId, l10n_util::GetStringUTF16( 46 ToastData toast(kToastId, l10n_util::GetStringUTF16(
47 IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_TOAST), 47 IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_TOAST),
48 kToastDurationMs, base::Optional<base::string16>()); 48 kToastDurationMs, base::Optional<base::string16>());
49 ash::WmShell::Get()->toast_manager()->Show(toast); 49 Shell::GetInstance()->toast_manager()->Show(toast);
50 50
51 WmShell::Get()->palette_delegate()->TakePartialScreenshot(base::Bind( 51 Shell::GetInstance()->palette_delegate()->TakePartialScreenshot(base::Bind(
52 &CaptureRegionMode::OnScreenshotDone, weak_factory_.GetWeakPtr())); 52 &CaptureRegionMode::OnScreenshotDone, weak_factory_.GetWeakPtr()));
53 delegate()->HidePalette(); 53 delegate()->HidePalette();
54 } 54 }
55 55
56 void CaptureRegionMode::OnDisable() { 56 void CaptureRegionMode::OnDisable() {
57 CommonPaletteTool::OnDisable(); 57 CommonPaletteTool::OnDisable();
58 58
59 // If the user manually cancelled the action we need to make sure to cancel 59 // If the user manually cancelled the action we need to make sure to cancel
60 // the screenshot session as well. 60 // the screenshot session as well.
61 WmShell::Get()->palette_delegate()->CancelPartialScreenshot(); 61 Shell::GetInstance()->palette_delegate()->CancelPartialScreenshot();
62 } 62 }
63 63
64 views::View* CaptureRegionMode::CreateView() { 64 views::View* CaptureRegionMode::CreateView() {
65 return CreateDefaultView( 65 return CreateDefaultView(
66 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION)); 66 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION));
67 } 67 }
68 68
69 const gfx::VectorIcon& CaptureRegionMode::GetPaletteIcon() const { 69 const gfx::VectorIcon& CaptureRegionMode::GetPaletteIcon() const {
70 return kPaletteActionCaptureRegionIcon; 70 return kPaletteActionCaptureRegionIcon;
71 } 71 }
72 72
73 void CaptureRegionMode::OnScreenshotDone() { 73 void CaptureRegionMode::OnScreenshotDone() {
74 // The screenshot finished, so disable the tool. 74 // The screenshot finished, so disable the tool.
75 delegate()->DisableTool(GetToolId()); 75 delegate()->DisableTool(GetToolId());
76 } 76 }
77 77
78 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/palette/palette_tray.cc ('k') | ash/common/system/chromeos/palette/tools/capture_screen_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698