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

Side by Side Diff: chrome/utility/importer/bookmark_html_reader.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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 "chrome/utility/importer/bookmark_html_reader.h" 5 #include "chrome/utility/importer/bookmark_html_reader.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "base/callback.h" 10 #include "base/callback.h"
8 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
9 #include "base/i18n/icu_string_conversions.h" 12 #include "base/i18n/icu_string_conversions.h"
13 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 18 #include "base/time/time.h"
15 #include "chrome/common/importer/imported_bookmark_entry.h" 19 #include "chrome/common/importer/imported_bookmark_entry.h"
16 #include "chrome/utility/importer/favicon_reencode.h" 20 #include "chrome/utility/importer/favicon_reencode.h"
17 #include "components/search_engines/search_terms_data.h" 21 #include "components/search_engines/search_terms_data.h"
18 #include "components/search_engines/template_url.h" 22 #include "components/search_engines/template_url.h"
19 #include "net/base/data_url.h" 23 #include "net/base/data_url.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 base::CodepageToUTF16(line.substr(tag_end, end - tag_end), charset.c_str(), 320 base::CodepageToUTF16(line.substr(tag_end, end - tag_end), charset.c_str(),
317 base::OnStringConversionError::SKIP, folder_name); 321 base::OnStringConversionError::SKIP, folder_name);
318 *folder_name = net::UnescapeForHTML(*folder_name); 322 *folder_name = net::UnescapeForHTML(*folder_name);
319 323
320 std::string attribute_list = line.substr(arraysize(kFolderOpen), 324 std::string attribute_list = line.substr(arraysize(kFolderOpen),
321 tag_end - arraysize(kFolderOpen) - 1); 325 tag_end - arraysize(kFolderOpen) - 1);
322 std::string value; 326 std::string value;
323 327
324 // Add date 328 // Add date
325 if (GetAttribute(attribute_list, kAddDateAttribute, &value)) { 329 if (GetAttribute(attribute_list, kAddDateAttribute, &value)) {
326 int64 time; 330 int64_t time;
327 base::StringToInt64(value, &time); 331 base::StringToInt64(value, &time);
328 // Upper bound it at 32 bits. 332 // Upper bound it at 32 bits.
329 if (0 < time && time < (1LL << 32)) 333 if (0 < time && time < (1LL << 32))
330 *add_date = base::Time::FromTimeT(time); 334 *add_date = base::Time::FromTimeT(time);
331 } 335 }
332 336
333 if (GetAttribute(attribute_list, kToolbarFolderAttribute, &value) && 337 if (GetAttribute(attribute_list, kToolbarFolderAttribute, &value) &&
334 base::LowerCaseEqualsASCII(value, "true")) 338 base::LowerCaseEqualsASCII(value, "true"))
335 *is_toolbar_folder = true; 339 *is_toolbar_folder = true;
336 else 340 else
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 406
403 // Keyword 407 // Keyword
404 if (GetAttribute(attribute_list, kShortcutURLAttribute, &value)) { 408 if (GetAttribute(attribute_list, kShortcutURLAttribute, &value)) {
405 base::CodepageToUTF16(value, charset.c_str(), 409 base::CodepageToUTF16(value, charset.c_str(),
406 base::OnStringConversionError::SKIP, shortcut); 410 base::OnStringConversionError::SKIP, shortcut);
407 *shortcut = net::UnescapeForHTML(*shortcut); 411 *shortcut = net::UnescapeForHTML(*shortcut);
408 } 412 }
409 413
410 // Add date 414 // Add date
411 if (GetAttribute(attribute_list, kAddDateAttribute, &value)) { 415 if (GetAttribute(attribute_list, kAddDateAttribute, &value)) {
412 int64 time; 416 int64_t time;
413 base::StringToInt64(value, &time); 417 base::StringToInt64(value, &time);
414 // Upper bound it at 32 bits. 418 // Upper bound it at 32 bits.
415 if (0 < time && time < (1LL << 32)) 419 if (0 < time && time < (1LL << 32))
416 *add_date = base::Time::FromTimeT(time); 420 *add_date = base::Time::FromTimeT(time);
417 } 421 }
418 422
419 // Post data. 423 // Post data.
420 if (GetAttribute(attribute_list, kPostDataAttribute, &value)) { 424 if (GetAttribute(attribute_list, kPostDataAttribute, &value)) {
421 base::CodepageToUTF16(value, charset.c_str(), 425 base::CodepageToUTF16(value, charset.c_str(),
422 base::OnStringConversionError::SKIP, post_data); 426 base::OnStringConversionError::SKIP, post_data);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 *url = GURL(value); 475 *url = GURL(value);
472 } 476 }
473 } 477 }
474 478
475 return true; 479 return true;
476 } 480 }
477 481
478 } // namespace internal 482 } // namespace internal
479 483
480 } // namespace bookmark_html_reader 484 } // namespace bookmark_html_reader
OLDNEW
« no previous file with comments | « chrome/utility/image_writer/image_writer_win.cc ('k') | chrome/utility/importer/bookmark_html_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698