1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef ASH_SESSION_STATE_OBSERVER_H_
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define ASH_SESSION_STATE_OBSERVER_H_
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <string>
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ash/ash_export.h"
11d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)#include "base/basictypes.h"
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace ash {
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class ASH_EXPORT SessionStateObserver {
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Called when active user has changed.
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void ActiveUserChanged(const std::string& user_id) {}
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Called when another user gets added to the existing session.
214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void UserAddedToSession(const std::string& user_id) {}
224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) protected:
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual ~SessionStateObserver() {}
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
27d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// A class to attach / detach an object as a session state observer with a
28d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)// scoped pointer.
29d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)class ASH_EXPORT ScopedSessionStateObserver {
30d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) public:
31d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)  explicit ScopedSessionStateObserver(ash::SessionStateObserver* observer);
32d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)  virtual ~ScopedSessionStateObserver();
33d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)
34d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles) private:
35d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)  ash::SessionStateObserver* observer_;
36d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)
37d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver);
38d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)};
39d57369da7c6519fef57db42085f7b42d4c8845c1Torne (Richard Coles)
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace ash
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif  // ASH_SESSION_STATE_OBSERVER_H_
43