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

Side by Side Diff: ash/tray_action/tray_action.h

Issue 2848813002: Introduce ash mojo interface for lock screen action handlers (Closed)
Patch Set: add ASH_EXPORTS 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
« no previous file with comments | « ash/shell.cc ('k') | ash/tray_action/tray_action.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ash_export.h"
9 #include "ash/public/interfaces/tray_action.mojom.h"
10 #include "base/macros.h"
11 #include "base/observer_list.h"
12 #include "mojo/public/cpp/bindings/binding_set.h"
13
14 namespace ash {
15
16 class TrayActionObserver;
17
18 // Controller that ash can use to request a predefined set of actions to be
19 // performed by clients.
20 // The controller provides an interface to:
21 // * Send a request to the client to handle an action.
22 // * Observe the state of support for an action as reported by the current ash
23 // client.
24 // Currently, only single action is supported - creating new note on the lock
25 // screen - Chrome handles this action by launching an app (if any) that is
26 // registered as a lock screen enabled action handler for the new note action.
27 class ASH_EXPORT TrayAction : public NON_EXPORTED_BASE(mojom::TrayAction) {
28 public:
29 TrayAction();
30 ~TrayAction() override;
31
32 void AddObserver(TrayActionObserver* observer);
33 void RemoveObserver(TrayActionObserver* observer);
34
35 void BindRequest(mojom::TrayActionRequest request);
36
37 // Gets last known handler state for the lock screen note action.
38 // It will return kNotAvailable if an action handler has not been set using
39 // |SetClient|.
40 mojom::TrayActionState GetLockScreenNoteState();
41
42 // If the client is set, sends it a request to handle the lock screen note
43 // action.
44 void RequestNewLockScreenNote();
45
46 // mojom::TrayAction:
47 void SetClient(mojom::TrayActionClientPtr action_handler,
48 mojom::TrayActionState lock_screen_note_state) override;
49 void UpdateLockScreenNoteState(mojom::TrayActionState state) override;
50
51 private:
52 // Notifies the observers that state for the lock screen note action has been
53 // updated.
54 void NotifyLockScreenNoteStateChanged();
55
56 // Last known state for lock screen note action.
57 mojom::TrayActionState lock_screen_note_state_ =
58 mojom::TrayActionState::kNotAvailable;
59
60 base::ObserverList<TrayActionObserver> observers_;
61
62 mojo::BindingSet<mojom::TrayAction> bindings_;
63
64 mojom::TrayActionClientPtr tray_action_client_;
65
66 DISALLOW_COPY_AND_ASSIGN(TrayAction);
67 };
68
69 } // namespace ash
70
71 #endif // ASH_TRAY_ACTION_TRAY_ACTION_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/tray_action/tray_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698