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