| 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/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/tab_helper.h" | 8 #include "chrome/browser/extensions/tab_helper.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return false; | 90 return false; |
| 91 tab->url = GURL(url_string); | 91 tab->url = GURL(url_string); |
| 92 | 92 |
| 93 if (value.GetString(kAppID, &(tab->app_id))) | 93 if (value.GetString(kAppID, &(tab->app_id))) |
| 94 tab->is_app = true; | 94 tab->is_app = true; |
| 95 | 95 |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 // static | 99 // static |
| 100 void PinnedTabCodec::RegisterUserPrefs(PrefService* prefs) { | 100 void PinnedTabCodec::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
| 101 prefs->RegisterListPref(prefs::kPinnedTabs, PrefService::UNSYNCABLE_PREF); | 101 prefs->RegisterListPref(prefs::kPinnedTabs, |
| 102 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // static | 105 // static |
| 105 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { | 106 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { |
| 106 PrefService* prefs = profile->GetPrefs(); | 107 PrefService* prefs = profile->GetPrefs(); |
| 107 if (!prefs) | 108 if (!prefs) |
| 108 return; | 109 return; |
| 109 | 110 |
| 110 ListValue values; | 111 ListValue values; |
| 111 for (BrowserList::const_iterator i = BrowserList::begin(); | 112 for (BrowserList::const_iterator i = BrowserList::begin(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { | 153 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { |
| 153 const base::DictionaryValue* tab_values = NULL; | 154 const base::DictionaryValue* tab_values = NULL; |
| 154 if (tabs_list->GetDictionary(i, &tab_values)) { | 155 if (tabs_list->GetDictionary(i, &tab_values)) { |
| 155 StartupTab tab; | 156 StartupTab tab; |
| 156 if (DecodeTab(*tab_values, &tab)) | 157 if (DecodeTab(*tab_values, &tab)) |
| 157 results.push_back(tab); | 158 results.push_back(tab); |
| 158 } | 159 } |
| 159 } | 160 } |
| 160 return results; | 161 return results; |
| 161 } | 162 } |
| OLD | NEW |