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 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 5 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 if (value.GetString(kAppID, &(tab->app_id))) | 97 if (value.GetString(kAppID, &(tab->app_id))) |
98 tab->is_app = true; | 98 tab->is_app = true; |
99 | 99 |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 // static | 103 // static |
104 void PinnedTabCodec::RegisterProfilePrefs( | 104 void PinnedTabCodec::RegisterProfilePrefs( |
105 user_prefs::PrefRegistrySyncable* registry) { | 105 user_prefs::PrefRegistrySyncable* registry) { |
106 registry->RegisterListPref(prefs::kPinnedTabs, | 106 registry->RegisterListPref(prefs::kPinnedTabs); |
107 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
108 } | 107 } |
109 | 108 |
110 // static | 109 // static |
111 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { | 110 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { |
112 PrefService* prefs = profile->GetPrefs(); | 111 PrefService* prefs = profile->GetPrefs(); |
113 if (!prefs) | 112 if (!prefs) |
114 return; | 113 return; |
115 | 114 |
116 base::ListValue values; | 115 base::ListValue values; |
117 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 116 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { | 156 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { |
158 const base::DictionaryValue* tab_values = NULL; | 157 const base::DictionaryValue* tab_values = NULL; |
159 if (tabs_list->GetDictionary(i, &tab_values)) { | 158 if (tabs_list->GetDictionary(i, &tab_values)) { |
160 StartupTab tab; | 159 StartupTab tab; |
161 if (DecodeTab(*tab_values, &tab)) | 160 if (DecodeTab(*tab_values, &tab)) |
162 results.push_back(tab); | 161 results.push_back(tab); |
163 } | 162 } |
164 } | 163 } |
165 return results; | 164 return results; |
166 } | 165 } |
OLD | NEW |