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/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 CreateNoteAction::CreateNoteAction(Delegate* delegate) |
| 16 : CommonPaletteTool(delegate) {} |
| 17 |
| 18 CreateNoteAction::~CreateNoteAction() {} |
| 19 |
| 20 PaletteGroup CreateNoteAction::GetGroup() const { |
| 21 return PaletteGroup::ACTION; |
| 22 } |
| 23 |
| 24 PaletteToolId CreateNoteAction::GetToolId() const { |
| 25 return PaletteToolId::CREATE_NOTE; |
| 26 } |
| 27 |
| 28 void CreateNoteAction::OnEnable() { |
| 29 CommonPaletteTool::OnEnable(); |
| 30 |
| 31 WmShell::Get()->palette_delegate()->CreateNote(); |
| 32 |
| 33 delegate()->DisableTool(GetToolId()); |
| 34 delegate()->HidePalette(); |
| 35 } |
| 36 |
| 37 views::View* CreateNoteAction::CreateView() { |
| 38 if (!WmShell::Get()->palette_delegate()->HasNoteApp()) |
| 39 return nullptr; |
| 40 |
| 41 return CreateDefaultView( |
| 42 l10n_util::GetStringUTF16(IDS_ASH_PALETTE_CREATE_NOTE_ACTION)); |
| 43 } |
| 44 |
| 45 gfx::VectorIconId CreateNoteAction::GetPaletteIconId() { |
| 46 return gfx::VectorIconId::PALETTE_ACTION_CREATE_NOTE; |
| 47 } |
| 48 |
| 49 } // namespace ash |
OLD | NEW |