| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" | 7 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 348 } |
| 349 | 349 |
| 350 void BookmarkEventRouter::OnWillAddBookmarkNode(BookmarkModel* model, | 350 void BookmarkEventRouter::OnWillAddBookmarkNode(BookmarkModel* model, |
| 351 BookmarkNode* node) { | 351 BookmarkNode* node) { |
| 352 // TODO(wittman): Remove this once extension hooks are in place to allow the | 352 // TODO(wittman): Remove this once extension hooks are in place to allow the |
| 353 // enhanced bookmarks extension to manage all bookmark creation code | 353 // enhanced bookmarks extension to manage all bookmark creation code |
| 354 // paths. See http://crbug.com/383557. | 354 // paths. See http://crbug.com/383557. |
| 355 if (IsEnhancedBookmarksExtensionActive(Profile::FromBrowserContext( | 355 if (IsEnhancedBookmarksExtensionActive(Profile::FromBrowserContext( |
| 356 browser_context_))) { | 356 browser_context_))) { |
| 357 static const char key[] = "stars.id"; | 357 static const char key[] = "stars.id"; |
| 358 node->SetMetaInfo(key, GenerateEnhancedBookmarksID(node->is_folder())); | 358 std::string value; |
| 359 if (!node->GetMetaInfo(key, &value)) |
| 360 node->SetMetaInfo(key, GenerateEnhancedBookmarksID(node->is_folder())); |
| 359 } | 361 } |
| 360 } | 362 } |
| 361 | 363 |
| 362 void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, | 364 void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, |
| 363 const BookmarkNode* parent, | 365 const BookmarkNode* parent, |
| 364 int index) { | 366 int index) { |
| 365 const BookmarkNode* node = parent->GetChild(index); | 367 const BookmarkNode* node = parent->GetChild(index); |
| 366 scoped_ptr<BookmarkTreeNode> tree_node( | 368 scoped_ptr<BookmarkTreeNode> tree_node( |
| 367 bookmark_api_helpers::GetBookmarkTreeNode(client_, node, false, false)); | 369 bookmark_api_helpers::GetBookmarkTreeNode(client_, node, false, false)); |
| 368 DispatchEvent(bookmarks::OnCreated::kEventName, | 370 DispatchEvent(bookmarks::OnCreated::kEventName, |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 #if !defined(OS_ANDROID) | 1114 #if !defined(OS_ANDROID) |
| 1113 // Android does not have support for the standard exporter. | 1115 // Android does not have support for the standard exporter. |
| 1114 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1116 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 1115 // Android. | 1117 // Android. |
| 1116 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 1118 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 1117 #endif | 1119 #endif |
| 1118 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1120 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 1119 } | 1121 } |
| 1120 | 1122 |
| 1121 } // namespace extensions | 1123 } // namespace extensions |
| OLD | NEW |