1// Copyright (c) 2010 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 CHROME_BROWSER_TABS_PINNED_TAB_CODEC_H_
6#define CHROME_BROWSER_TABS_PINNED_TAB_CODEC_H_
7#pragma once
8
9#include <vector>
10
11#include "chrome/browser/ui/browser_init.h"
12#include "googleurl/src/gurl.h"
13
14class PrefService;
15class Profile;
16
17// PinnedTabCodec is used to read and write the set of pinned tabs to
18// preferences. When Chrome exits the sets of pinned tabs are written to prefs.
19// On startup if the user has not chosen to restore the last session the set of
20// pinned tabs is opened.
21//
22// The entries are stored in preferences as a list of dictionaries, with each
23// dictionary describing the entry.
24class PinnedTabCodec {
25 public:
26  // Registers the preference used by this class.
27  static void RegisterUserPrefs(PrefService* prefs);
28
29  // Resets the preferences state.
30  static void WritePinnedTabs(Profile* profile);
31
32  // Reads and returns the set of pinned tabs to restore from preferences.
33  static std::vector<BrowserInit::LaunchWithProfile::Tab> ReadPinnedTabs(
34      Profile* profile);
35
36 private:
37  PinnedTabCodec();
38  ~PinnedTabCodec();
39
40  DISALLOW_COPY_AND_ASSIGN(PinnedTabCodec);
41};
42
43#endif  // CHROME_BROWSER_TABS_PINNED_TAB_CODEC_H_
44