Vladislav Kaznacheev | 92edf62e | 2017-10-13 22:08:01 | [diff] [blame] | 1 | // Copyright 2017 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 | #ifndef ASH_NOTETAKING_CONTROLLER_H_ |
| 6 | #define ASH_NOTETAKING_CONTROLLER_H_ |
| 7 | |
| 8 | #include "ash/ash_export.h" |
| 9 | #include "ash/public/interfaces/note_taking_controller.mojom.h" |
| 10 | #include "mojo/public/cpp/bindings/binding.h" |
| 11 | |
| 12 | namespace ash { |
| 13 | |
| 14 | // Controller for the note taking functionality. |
| 15 | class ASH_EXPORT NoteTakingController : public mojom::NoteTakingController { |
| 16 | public: |
| 17 | NoteTakingController(); |
| 18 | ~NoteTakingController() override; |
| 19 | |
| 20 | void BindRequest(mojom::NoteTakingControllerRequest request); |
| 21 | |
| 22 | // mojom::NoteTakingController: |
| 23 | void SetClient(mojom::NoteTakingControllerClientPtr client) override; |
| 24 | |
| 25 | // Returns true if the client is attached. |
| 26 | bool CanCreateNote() const; |
| 27 | |
| 28 | // Calls the method of the same name on |client_|. |
| 29 | void CreateNote(); |
| 30 | |
| 31 | private: |
| 32 | friend class TestNoteTakingControllerClient; |
| 33 | |
| 34 | void OnClientConnectionLost(); |
| 35 | |
| 36 | void FlushMojoForTesting(); |
| 37 | |
| 38 | // Binding for mojom::NoteTakingController interface. |
| 39 | mojo::Binding<ash::mojom::NoteTakingController> binding_; |
| 40 | |
| 41 | // Interface to NoteTaking controller client (chrome). |
| 42 | mojom::NoteTakingControllerClientPtr client_; |
| 43 | |
| 44 | DISALLOW_COPY_AND_ASSIGN(NoteTakingController); |
| 45 | }; |
| 46 | |
| 47 | } // namespace ash |
| 48 | |
| 49 | #endif // ASH_NOTETAKING_CONTROLLER_H_ |