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