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/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
10 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return false; | 94 return false; |
95 tab->url = GURL(url_string); | 95 tab->url = GURL(url_string); |
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::RegisterUserPrefs( | 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); | 107 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
108 } | 108 } |
109 | 109 |
110 // static | 110 // static |
111 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { | 111 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { |
112 PrefService* prefs = profile->GetPrefs(); | 112 PrefService* prefs = profile->GetPrefs(); |
113 if (!prefs) | 113 if (!prefs) |
114 return; | 114 return; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { | 157 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { |
158 const base::DictionaryValue* tab_values = NULL; | 158 const base::DictionaryValue* tab_values = NULL; |
159 if (tabs_list->GetDictionary(i, &tab_values)) { | 159 if (tabs_list->GetDictionary(i, &tab_values)) { |
160 StartupTab tab; | 160 StartupTab tab; |
161 if (DecodeTab(*tab_values, &tab)) | 161 if (DecodeTab(*tab_values, &tab)) |
162 results.push_back(tab); | 162 results.push_back(tab); |
163 } | 163 } |
164 } | 164 } |
165 return results; | 165 return results; |
166 } | 166 } |
OLD | NEW |