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

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

Issue 2876993002: Introduce window container to be used by lock screen app windows (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
« no previous file with comments | « ash/tray_action/tray_action.h ('k') | ash/tray_action/tray_action_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/tray_action/tray_action.h" 5 #include "ash/tray_action/tray_action.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/tray_action/tray_action_observer.h" 9 #include "ash/tray_action/tray_action_observer.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 void TrayAction::RemoveObserver(TrayActionObserver* observer) { 24 void TrayAction::RemoveObserver(TrayActionObserver* observer) {
25 observers_.RemoveObserver(observer); 25 observers_.RemoveObserver(observer);
26 } 26 }
27 27
28 void TrayAction::BindRequest(mojom::TrayActionRequest request) { 28 void TrayAction::BindRequest(mojom::TrayActionRequest request) {
29 bindings_.AddBinding(this, std::move(request)); 29 bindings_.AddBinding(this, std::move(request));
30 } 30 }
31 31
32 mojom::TrayActionState TrayAction::GetLockScreenNoteState() { 32 mojom::TrayActionState TrayAction::GetLockScreenNoteState() const {
33 if (!tray_action_client_) 33 if (!tray_action_client_)
34 return mojom::TrayActionState::kNotAvailable; 34 return mojom::TrayActionState::kNotAvailable;
35 return lock_screen_note_state_; 35 return lock_screen_note_state_;
36 } 36 }
37 37
38 bool TrayAction::IsLockScreenNoteActive() const {
39 return GetLockScreenNoteState() == mojom::TrayActionState::kActive;
40 }
41
38 void TrayAction::SetClient(mojom::TrayActionClientPtr tray_action_client, 42 void TrayAction::SetClient(mojom::TrayActionClientPtr tray_action_client,
39 mojom::TrayActionState lock_screen_note_state) { 43 mojom::TrayActionState lock_screen_note_state) {
40 mojom::TrayActionState old_lock_screen_note_state = GetLockScreenNoteState(); 44 mojom::TrayActionState old_lock_screen_note_state = GetLockScreenNoteState();
41 45
42 tray_action_client_ = std::move(tray_action_client); 46 tray_action_client_ = std::move(tray_action_client);
43 47
44 if (tray_action_client_) { 48 if (tray_action_client_) {
45 // Makes sure the state is updated in case the connection is lost. 49 // Makes sure the state is updated in case the connection is lost.
46 tray_action_client_.set_connection_error_handler( 50 tray_action_client_.set_connection_error_handler(
47 base::Bind(&TrayAction::SetClient, base::Unretained(this), nullptr, 51 base::Bind(&TrayAction::SetClient, base::Unretained(this), nullptr,
(...skipping 27 matching lines...) Expand all
75 DCHECK(tray_action_client_); 79 DCHECK(tray_action_client_);
76 tray_action_client_->RequestNewLockScreenNote(); 80 tray_action_client_->RequestNewLockScreenNote();
77 } 81 }
78 82
79 void TrayAction::NotifyLockScreenNoteStateChanged() { 83 void TrayAction::NotifyLockScreenNoteStateChanged() {
80 for (auto& observer : observers_) 84 for (auto& observer : observers_)
81 observer.OnLockScreenNoteStateChanged(GetLockScreenNoteState()); 85 observer.OnLockScreenNoteStateChanged(GetLockScreenNoteState());
82 } 86 }
83 87
84 } // namespace ash 88 } // namespace ash
OLDNEW
« no previous file with comments | « ash/tray_action/tray_action.h ('k') | ash/tray_action/tray_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698