Infobar material design refresh: bg color
[chromium-blink-merge.git] / ios / web / active_state_manager_impl.h
blob3a383384706dc58487512e3d889fbe1e9642f201
1 // Copyright 2015 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.
5 #ifndef IOS_WEB_ACTIVE_STATE_MANAGER_IMPL_H_
6 #define IOS_WEB_ACTIVE_STATE_MANAGER_IMPL_H_
8 #include "base/macros.h"
9 #include "base/observer_list.h"
10 #include "base/supports_user_data.h"
11 #include "ios/web/public/active_state_manager.h"
13 namespace web {
15 class BrowserState;
17 // Concrete subclass of web::ActiveStateManager. Informs observers when an
18 // ActiveStateManager becomes active/inactive.
19 class ActiveStateManagerImpl : public ActiveStateManager,
20 public base::SupportsUserData::Data {
21 public:
22 explicit ActiveStateManagerImpl(BrowserState* browser_state);
23 ~ActiveStateManagerImpl() override;
25 // ActiveStateManager methods.
26 void SetActive(bool active) override;
27 bool IsActive() override;
28 void AddObserver(ActiveStateManager::Observer* observer) override;
29 void RemoveObserver(ActiveStateManager::Observer* observer) override;
31 private:
32 BrowserState* browser_state_; // weak, owns this object.
33 // true if the ActiveStateManager is active.
34 bool active_;
35 // The list of observers.
36 base::ObserverList<Observer> observer_list_;
38 DISALLOW_COPY_AND_ASSIGN(ActiveStateManagerImpl);
41 } // namespace web
43 #endif // IOS_WEB_ACTIVE_STATE_MANAGER_IMPL_H_