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

Side by Side Diff: ash/tray_action_handler/tray_action_handler_controller.h

Issue 2848813002: Introduce ash mojo interface for lock screen action handlers (Closed)
Patch Set: . Created 3 years, 7 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 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_TRAY_ACTION_HANDLER_TRAY_ACTION_HANDLER_CONTROLLER_H_
6 #define ASH_TRAY_ACTION_HANDLER_TRAY_ACTION_HANDLER_CONTROLLER_H_
7
8 #include "ash/public/interfaces/tray_action_handler.mojom.h"
9 #include "base/macros.h"
10 #include "base/observer_list.h"
11 #include "mojo/public/cpp/bindings/binding_set.h"
12
13 namespace ash {
14
15 class TrayActionHandlerObserver;
16
17 // Controller that ash can use to request a predefined set of actions to be
18 // performed by clients.
19 // The controller provides an interface to:
20 // * Send a request to the client to handle an action.
21 // * Observe the state of support for an action as reported by the current ash
22 // client.
23 // Currently, only single action is supported - creating new note on the lock
24 // screen.
25 class TrayActionHandlerController : public mojom::TrayActionHandlerController {
26 public:
27 TrayActionHandlerController();
28 ~TrayActionHandlerController() override;
29
30 void AddObserver(TrayActionHandlerObserver* observer);
31 void RemoveObserver(TrayActionHandlerObserver* observer);
32
33 void BindRequest(mojom::TrayActionHandlerControllerRequest request);
34
35 // Gets last known handler state for the action.
36 // It will return kNotSupported if an action handler has not been set using
37 // |SetClient|.
38 mojom::TrayActionHandlerState GetState(mojom::TrayActionHandlerAction action);
39
40 // If an action handler is set, send it a request to handle the action.
41 void RequestHandleAction(mojom::TrayActionHandlerAction action);
42
43 // mojom::TrayActionHandlerController impl:
James Cook 2017/05/03 23:31:51 super-nit: Just "mojom::TrayActionHandlerControlle
tbarzic 2017/05/04 20:58:30 Done.
44 void SetClient(mojom::TrayActionHandlerClientPtr action_handler) override;
45 void UpdateActionHandlerState(mojom::TrayActionHandlerAction action,
46 mojom::TrayActionHandlerState state) override;
47
48 private:
49 // Notifies the observers that state for the action has been updated.
50 void NotifyActionStateChanged(mojom::TrayActionHandlerAction action);
51
52 // Last known state for new_note action.
53 mojom::TrayActionHandlerState new_note_state_ =
54 mojom::TrayActionHandlerState::kNotSupported;
55
56 base::ObserverList<TrayActionHandlerObserver> observers_;
57
58 mojo::BindingSet<mojom::TrayActionHandlerController> bindings_;
59
60 mojom::TrayActionHandlerClientPtr action_handler_client_;
61
62 DISALLOW_COPY_AND_ASSIGN(TrayActionHandlerController);
63 };
64
65 } // namespace ash
66
67 #endif // ASH_TRAY_ACTION_HANDLER_TRAY_ACTION_HANDLER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698