| 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/extensions/api/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } else { | 163 } else { |
| 164 index = *details.index; | 164 index = *details.index; |
| 165 if (index > parent->child_count() || index < 0) { | 165 if (index > parent->child_count() || index < 0) { |
| 166 error_ = keys::kInvalidIndexError; | 166 error_ = keys::kInvalidIndexError; |
| 167 return NULL; | 167 return NULL; |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 base::string16 title; // Optional. | 171 base::string16 title; // Optional. |
| 172 if (details.title.get()) | 172 if (details.title.get()) |
| 173 title = base::UTF8ToUTF16(*details.title.get()); | 173 title = base::UTF8ToUTF16(*details.title); |
| 174 | 174 |
| 175 std::string url_string; // Optional. | 175 std::string url_string; // Optional. |
| 176 if (details.url.get()) | 176 if (details.url.get()) |
| 177 url_string = *details.url.get(); | 177 url_string = *details.url; |
| 178 | 178 |
| 179 GURL url(url_string); | 179 GURL url(url_string); |
| 180 if (!url_string.empty() && !url.is_valid()) { | 180 if (!url_string.empty() && !url.is_valid()) { |
| 181 error_ = keys::kInvalidUrlError; | 181 error_ = keys::kInvalidUrlError; |
| 182 return NULL; | 182 return NULL; |
| 183 } | 183 } |
| 184 | 184 |
| 185 const BookmarkNode* node; | 185 const BookmarkNode* node; |
| 186 if (url_string.length()) { | 186 if (url_string.length()) { |
| 187 node = model->AddURLWithCreationTimeAndMetaInfo( | 187 node = model->AddURLWithCreationTimeAndMetaInfo( |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 839 } |
| 840 | 840 |
| 841 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 841 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
| 842 int index, | 842 int index, |
| 843 void* params) { | 843 void* params) { |
| 844 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 844 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 845 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 845 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 846 } | 846 } |
| 847 | 847 |
| 848 } // namespace extensions | 848 } // namespace extensions |
| OLD | NEW |