Chromium Code Reviews| 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 namespace { | |
| 15 | |
| 16 bool IsNoteAppAvailable() { | |
|
Evan Stade
2016/08/22 15:12:21
why not just inline this in the one place it's use
jdufault
2016/08/22 16:29:20
Done.
| |
| 17 return WmShell::Get()->palette_delegate()->HasNoteApp(); | |
| 18 } | |
| 19 | |
| 20 } // namespace | |
| 21 | |
| 22 CreateNoteAction::CreateNoteAction(Delegate* delegate) | |
| 23 : CommonPaletteTool(delegate) {} | |
| 24 | |
| 25 CreateNoteAction::~CreateNoteAction() {} | |
| 26 | |
| 27 PaletteGroup CreateNoteAction::GetGroup() const { | |
| 28 return PaletteGroup::ACTION; | |
| 29 } | |
| 30 | |
| 31 PaletteToolId CreateNoteAction::GetToolId() const { | |
| 32 return PaletteToolId::CREATE_NOTE; | |
| 33 } | |
| 34 | |
| 35 void CreateNoteAction::OnEnable() { | |
| 36 CommonPaletteTool::OnEnable(); | |
| 37 | |
| 38 WmShell::Get()->palette_delegate()->CreateNote(); | |
| 39 | |
| 40 delegate()->DisableTool(GetToolId()); | |
| 41 delegate()->HidePalette(); | |
| 42 } | |
| 43 | |
| 44 views::View* CreateNoteAction::CreateView() { | |
| 45 if (!IsNoteAppAvailable()) | |
| 46 return nullptr; | |
| 47 | |
| 48 return CreateDefaultView( | |
| 49 l10n_util::GetStringUTF16(IDS_ASH_PALETTE_CREATE_NOTE_ACTION)); | |
| 50 } | |
| 51 | |
| 52 gfx::VectorIconId CreateNoteAction::GetPaletteIconId() { | |
| 53 return gfx::VectorIconId::PALETTE_ACTION_CREATE_NOTE; | |
| 54 } | |
| 55 | |
| 56 } // namespace ash | |
| OLD | NEW |