Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/ui/tabs/pinned_tab_codec.cc

Issue 12114034: Swap BrowserList::const_iterator for the multi-desktop aware BrowserIterator in many scenarios. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_iterator.h"
13 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 20
20 using content::NavigationEntry; 21 using content::NavigationEntry;
21 22
22 // Key used in dictionaries for the app id. 23 // Key used in dictionaries for the app id.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 PrefServiceSyncable::UNSYNCABLE_PREF); 103 PrefServiceSyncable::UNSYNCABLE_PREF);
103 } 104 }
104 105
105 // static 106 // static
106 void PinnedTabCodec::WritePinnedTabs(Profile* profile) { 107 void PinnedTabCodec::WritePinnedTabs(Profile* profile) {
107 PrefService* prefs = profile->GetPrefs(); 108 PrefService* prefs = profile->GetPrefs();
108 if (!prefs) 109 if (!prefs)
109 return; 110 return;
110 111
111 ListValue values; 112 ListValue values;
112 for (BrowserList::const_iterator i = BrowserList::begin(); 113 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
113 i != BrowserList::end(); ++i) { 114 Browser* browser = *it;
114 Browser* browser = *i;
115 if (browser->is_type_tabbed() && 115 if (browser->is_type_tabbed() &&
116 browser->profile() == profile && HasPinnedTabs(browser)) { 116 browser->profile() == profile && HasPinnedTabs(browser)) {
117 EncodePinnedTabs(browser, &values); 117 EncodePinnedTabs(browser, &values);
118 } 118 }
119 } 119 }
120 prefs->Set(prefs::kPinnedTabs, values); 120 prefs->Set(prefs::kPinnedTabs, values);
121 } 121 }
122 122
123 // static 123 // static
124 void PinnedTabCodec::WritePinnedTabs(Profile* profile, 124 void PinnedTabCodec::WritePinnedTabs(Profile* profile,
(...skipping 28 matching lines...) Expand all
153 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) {
154 const base::DictionaryValue* tab_values = NULL; 154 const base::DictionaryValue* tab_values = NULL;
155 if (tabs_list->GetDictionary(i, &tab_values)) { 155 if (tabs_list->GetDictionary(i, &tab_values)) {
156 StartupTab tab; 156 StartupTab tab;
157 if (DecodeTab(*tab_values, &tab)) 157 if (DecodeTab(*tab_values, &tab))
158 results.push_back(tab); 158 results.push_back(tab);
159 } 159 }
160 } 160 }
161 return results; 161 return results;
162 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/browser_synced_window_delegate.cc ('k') | chrome/browser/ui/uma_browsing_activity_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698