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

Side by Side Diff: ios/chrome/browser/sessions/session_window.mm

Issue 2687353003: Created SerializableUserDataManager. (Closed)
Patch Set: Eugene's comments Created 3 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "ios/chrome/browser/sessions/session_window.h" 5 #import "ios/chrome/browser/sessions/session_window.h"
6 6
7 #include <list> 7 #include <list>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return [NSArray arrayWithArray:_sessions]; 54 return [NSArray arrayWithArray:_sessions];
55 } 55 }
56 56
57 - (void)setSelectedIndex:(NSUInteger)selectedIndex { 57 - (void)setSelectedIndex:(NSUInteger)selectedIndex {
58 DCHECK([self isIndex:selectedIndex validForSessionCount:[_sessions count]]); 58 DCHECK([self isIndex:selectedIndex validForSessionCount:[_sessions count]]);
59 _selectedIndex = selectedIndex; 59 _selectedIndex = selectedIndex;
60 } 60 }
61 61
62 #pragma mark - Public 62 #pragma mark - Public
63 63
64 - (void)addSerializedSession:(CRWNavigationManagerStorage*)session { 64 - (void)addSerializedSessionStorage:(CRWSessionStorage*)session {
65 [_sessions addObject:session]; 65 [_sessions addObject:session];
66 // Set the selected index to 0 (this session) if this is the first session 66 // Set the selected index to 0 (this session) if this is the first session
67 // added. 67 // added.
68 if (_selectedIndex == NSNotFound) 68 if (_selectedIndex == NSNotFound)
69 _selectedIndex = 0; 69 _selectedIndex = 0;
70 } 70 }
71 71
72 - (void)clearSessions { 72 - (void)clearSessions {
73 [_sessions removeAllObjects]; 73 [_sessions removeAllObjects];
74 _selectedIndex = NSNotFound; 74 _selectedIndex = NSNotFound;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 (!sessionCount && index == NSNotFound); 110 (!sessionCount && index == NSNotFound);
111 } 111 }
112 112
113 - (NSString*)description { 113 - (NSString*)description {
114 return [NSString stringWithFormat:@"selected index: %" PRIuNS 114 return [NSString stringWithFormat:@"selected index: %" PRIuNS
115 "\nsessions:\n%@\n", 115 "\nsessions:\n%@\n",
116 _selectedIndex, _sessions.get()]; 116 _selectedIndex, _sessions.get()];
117 } 117 }
118 118
119 @end 119 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/sessions/session_window.h ('k') | ios/chrome/browser/sessions/session_window_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698