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/bookmarks/bookmark_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 error_ = keys::kInvalidIndexError; | 497 error_ = keys::kInvalidIndexError; |
498 return false; | 498 return false; |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 string16 title; | 502 string16 title; |
503 json->GetString(keys::kTitleKey, &title); // Optional. | 503 json->GetString(keys::kTitleKey, &title); // Optional. |
504 std::string url_string; | 504 std::string url_string; |
505 json->GetString(keys::kUrlKey, &url_string); // Optional. | 505 json->GetString(keys::kUrlKey, &url_string); // Optional. |
506 GURL url(url_string); | 506 GURL url(url_string); |
507 if (!url.is_empty() && !url.is_valid()) { | 507 if (!url_string.empty() && !url.is_valid()) { |
508 error_ = keys::kInvalidUrlError; | 508 error_ = keys::kInvalidUrlError; |
509 return false; | 509 return false; |
510 } | 510 } |
511 | 511 |
512 const BookmarkNode* node; | 512 const BookmarkNode* node; |
513 if (url_string.length()) | 513 if (url_string.length()) |
514 node = model->AddURL(parent, index, title, url); | 514 node = model->AddURL(parent, index, title, url); |
515 else | 515 else |
516 node = model->AddFolder(parent, index, title); | 516 node = model->AddFolder(parent, index, title); |
517 DCHECK(node); | 517 DCHECK(node); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 int index, | 945 int index, |
946 void* params) { | 946 void* params) { |
947 #if !defined(OS_ANDROID) | 947 #if !defined(OS_ANDROID) |
948 // Android does not have support for the standard exporter. | 948 // Android does not have support for the standard exporter. |
949 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 949 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
950 // Android. | 950 // Android. |
951 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 951 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
952 #endif | 952 #endif |
953 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 953 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
954 } | 954 } |
OLD | NEW |