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

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

Issue 2235063002: Add create note palette action. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app-runtime-changes
Patch Set: Initial upload Created 4 years, 4 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/create_note_action.h"
6
7 #include "ash/common/palette_delegate.h"
8 #include "ash/common/system/chromeos/palette/palette_ids.h"
9 #include "ash/common/wm_shell.h"
10 #include "grit/ash_strings.h"
11 #include "ui/base/l10n/l10n_util.h"
12
13 namespace ash {
14
15 // static
16 bool CreateNoteAction::IsAvailable() {
17 return WmShell::Get()->palette_delegate()->HasNoteApp();
18 }
19
20 CreateNoteAction::CreateNoteAction(Delegate* delegate)
21 : CommonPaletteTool(delegate) {}
22
23 CreateNoteAction::~CreateNoteAction() {}
24
25 PaletteGroup CreateNoteAction::GetGroup() const {
26 return PaletteGroup::ACTION;
27 }
28
29 PaletteToolId CreateNoteAction::GetToolId() const {
30 return PaletteToolId::CREATE_NOTE;
31 }
32
33 void CreateNoteAction::OnEnable() {
34 CommonPaletteTool::OnEnable();
35
36 WmShell::Get()->palette_delegate()->CreateNote();
37
38 delegate()->DisableTool(GetToolId());
39 delegate()->HidePalette();
40 }
41
42 views::View* CreateNoteAction::CreateView() {
43 if (!IsAvailable())
44 return nullptr;
45
46 return CreateDefaultView(
47 l10n_util::GetStringUTF16(IDS_ASH_PALETTE_CREATE_NOTE_ACTION));
48 }
49
50 gfx::VectorIconId CreateNoteAction::GetPaletteIconId() {
51 return gfx::VectorIconId::PALETTE_ACTION_CREATE_NOTE;
52 }
53
54 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698