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

Side by Side Diff: ash/tray_action/tray_action.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_TRAY_ACTION_H_
6 #define ASH_TRAY_ACTION_TRAY_ACTION_H_
7
8 #include "ash/public/interfaces/tray_action.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 TrayActionObserver;
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 - Chrome handles this action by launching an app (if any) that is
25 // registered as a lock screen enabled action handler for the new note action.
26 class TrayAction : public mojom::TrayAction {
27 public:
28 TrayAction();
29 ~TrayAction() override;
30
31 void AddObserver(TrayActionObserver* observer);
32 void RemoveObserver(TrayActionObserver* observer);
33
34 void BindRequest(mojom::TrayActionRequest request);
35
36 // Gets last known handler state for the lock screen note action.
37 // It will return kNotSupported if an action handler has not been set using
38 // |SetClient|.
39 mojom::TrayActionState GetLockScreenNoteState();
40
41 // If the client is set, send it a request to handle the lock screen note
42 // action.
43 void RequestNewLockScreenNote();
44
45 // mojom::TrayAction:
46 void SetClient(mojom::TrayActionClientPtr action_handler) override;
47 void UpdateLockScreenNoteState(mojom::TrayActionState state) override;
48
49 private:
50 // Notifies the observers that state for the lock screen note action has been
51 // updated.
52 void NotifyLockScreenNoteStateChanged();
53
54 // Last known state for lock screen note action.
55 mojom::TrayActionState lock_screen_note_state_ =
56 mojom::TrayActionState::kNotSupported;
57
58 base::ObserverList<TrayActionObserver> observers_;
59
60 mojo::BindingSet<mojom::TrayAction> bindings_;
61
62 mojom::TrayActionClientPtr tray_action_client_;
63
64 DISALLOW_COPY_AND_ASSIGN(TrayAction);
65 };
66
67 } // namespace ash
68
69 #endif // ASH_TRAY_ACTION_TRAY_ACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698