| 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 "ash/resources/vector_icons/vector_icons.h" | |
| 11 #include "ash/strings/grit/ash_strings.h" | |
| 12 #include "ui/base/l10n/l10n_util.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 | |
| 16 CreateNoteAction::CreateNoteAction(Delegate* delegate) | |
| 17 : CommonPaletteTool(delegate) {} | |
| 18 | |
| 19 CreateNoteAction::~CreateNoteAction() {} | |
| 20 | |
| 21 PaletteGroup CreateNoteAction::GetGroup() const { | |
| 22 return PaletteGroup::ACTION; | |
| 23 } | |
| 24 | |
| 25 PaletteToolId CreateNoteAction::GetToolId() const { | |
| 26 return PaletteToolId::CREATE_NOTE; | |
| 27 } | |
| 28 | |
| 29 void CreateNoteAction::OnEnable() { | |
| 30 CommonPaletteTool::OnEnable(); | |
| 31 | |
| 32 WmShell::Get()->palette_delegate()->CreateNote(); | |
| 33 | |
| 34 delegate()->DisableTool(GetToolId()); | |
| 35 delegate()->HidePalette(); | |
| 36 } | |
| 37 | |
| 38 views::View* CreateNoteAction::CreateView() { | |
| 39 if (!WmShell::Get()->palette_delegate()->HasNoteApp()) | |
| 40 return nullptr; | |
| 41 | |
| 42 return CreateDefaultView( | |
| 43 l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_CREATE_NOTE_ACTION)); | |
| 44 } | |
| 45 | |
| 46 const gfx::VectorIcon& CreateNoteAction::GetPaletteIcon() const { | |
| 47 return kPaletteActionCreateNoteIcon; | |
| 48 } | |
| 49 | |
| 50 } // namespace ash | |
| OLD | NEW |