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

Side by Side Diff: components/sessions/serialized_navigation_entry.cc

Issue 107383002: Use base namespace for string16 in components and cloud_print. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/sessions/serialized_navigation_entry.h" 5 #include "components/sessions/serialized_navigation_entry.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/favicon_status.h" 9 #include "content/public/browser/favicon_status.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const std::string& str) { 169 const std::string& str) {
170 int num_bytes = str.size() * sizeof(char); 170 int num_bytes = str.size() * sizeof(char);
171 if (*bytes_written + num_bytes < max_bytes) { 171 if (*bytes_written + num_bytes < max_bytes) {
172 *bytes_written += num_bytes; 172 *bytes_written += num_bytes;
173 pickle->WriteString(str); 173 pickle->WriteString(str);
174 } else { 174 } else {
175 pickle->WriteString(std::string()); 175 pickle->WriteString(std::string());
176 } 176 }
177 } 177 }
178 178
179 // string16 version of WriteStringToPickle. 179 // base::string16 version of WriteStringToPickle.
180 // 180 //
181 // TODO(akalin): Unify this, too. 181 // TODO(akalin): Unify this, too.
182 void WriteString16ToPickle(Pickle* pickle, 182 void WriteString16ToPickle(Pickle* pickle,
183 int* bytes_written, 183 int* bytes_written,
184 int max_bytes, 184 int max_bytes,
185 const string16& str) { 185 const base::string16& str) {
186 int num_bytes = str.size() * sizeof(char16); 186 int num_bytes = str.size() * sizeof(char16);
187 if (*bytes_written + num_bytes < max_bytes) { 187 if (*bytes_written + num_bytes < max_bytes) {
188 *bytes_written += num_bytes; 188 *bytes_written += num_bytes;
189 pickle->WriteString16(str); 189 pickle->WriteString16(str);
190 } else { 190 } else {
191 pickle->WriteString16(string16()); 191 pickle->WriteString16(base::string16());
192 } 192 }
193 } 193 }
194 194
195 // A mask used for arbitrary boolean values needed to represent a 195 // A mask used for arbitrary boolean values needed to represent a
196 // NavigationEntry. Currently only contains HAS_POST_DATA. 196 // NavigationEntry. Currently only contains HAS_POST_DATA.
197 // 197 //
198 // NOTE(akalin): We may want to just serialize |has_post_data_| 198 // NOTE(akalin): We may want to just serialize |has_post_data_|
199 // directly. Other bools (|is_overriding_user_agent_|) haven't been 199 // directly. Other bools (|is_overriding_user_agent_|) haven't been
200 // added to this mask. 200 // added to this mask.
201 enum TypeMask { 201 enum TypeMask {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 for (std::vector<SerializedNavigationEntry>::const_iterator 479 for (std::vector<SerializedNavigationEntry>::const_iterator
480 it = navigations.begin(); it != navigations.end(); ++it) { 480 it = navigations.begin(); it != navigations.end(); ++it) {
481 entries.push_back( 481 entries.push_back(
482 it->ToNavigationEntry(page_id, browser_context).release()); 482 it->ToNavigationEntry(page_id, browser_context).release());
483 ++page_id; 483 ++page_id;
484 } 484 }
485 return entries; 485 return entries;
486 } 486 }
487 487
488 } // namespace sessions 488 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/serialized_navigation_entry.h ('k') | components/sessions/serialized_navigation_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698