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_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_
10 #include "base/macros.h"
11 #include "base/observer_list.h"
12 #include "base/strings/string16.h"
20 class BrowserStateInfoCacheObserver
;
22 // This class saves various information about browser states to local
24 class BrowserStateInfoCache
{
26 BrowserStateInfoCache();
27 virtual ~BrowserStateInfoCache();
29 // Adds and removes an observer.
30 void AddObserver(BrowserStateInfoCacheObserver
* observer
);
31 void RemoveObserver(BrowserStateInfoCacheObserver
* observer
);
33 // Gets and sets information related to browser states.
34 virtual size_t GetIndexOfBrowserStateWithPath(
35 const base::FilePath
& profile_path
) const = 0;
36 virtual void SetLocalAuthCredentialsOfBrowserStateAtIndex(
38 const std::string
& credentials
) = 0;
39 virtual void SetAuthInfoOfBrowserStateAtIndex(
41 const std::string
& gaia_id
,
42 const base::string16
& user_name
) = 0;
43 virtual void SetBrowserStateSigninRequiredAtIndex(size_t index
,
45 virtual void SetBrowserStateIsAuthErrorAtIndex(size_t index
, bool value
) = 0;
46 virtual std::string
GetPasswordChangeDetectionTokenAtIndex(
47 size_t index
) const = 0;
48 virtual void SetPasswordChangeDetectionTokenAtIndex(
50 const std::string
& token
) = 0;
53 // Methods calling the observers in |observer_list_|.
54 void NotifyBrowserStateAdded(const base::FilePath
& path
);
55 void NotifyBrowserStateRemoved(const base::FilePath
& profile_path
,
56 const base::string16
& name
);
59 base::ObserverList
<BrowserStateInfoCacheObserver
, true> observer_list_
;
61 DISALLOW_COPY_AND_ASSIGN(BrowserStateInfoCache
);
66 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_BROWSER_STATE_INFO_CACHE_H_