| 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/history/android/bookmark_model_sql_handler.h" | 5 #include "chrome/browser/history/android/bookmark_model_sql_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (mobile_node) | 39 if (mobile_node) |
| 40 bookmark_model->AddURL(mobile_node, 0, title, url); | 40 bookmark_model->AddURL(mobile_node, 0, title, url); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, | 43 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, |
| 44 const base::string16& title, | 44 const base::string16& title, |
| 45 int64 parent_id) { | 45 int64 parent_id) { |
| 46 BookmarkModel* bookmark_model = GetBookmarkModel(); | 46 BookmarkModel* bookmark_model = GetBookmarkModel(); |
| 47 if (!bookmark_model) | 47 if (!bookmark_model) |
| 48 return; | 48 return; |
| 49 const BookmarkNode* parent = GetBookmarkNodeByID(bookmark_model, parent_id); | 49 const BookmarkNode* parent = |
| 50 bookmarks::GetBookmarkNodeByID(bookmark_model, parent_id); |
| 50 if (parent) | 51 if (parent) |
| 51 bookmark_model->AddURL(parent, 0, title, url); | 52 bookmark_model->AddURL(parent, 0, title, url); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void BookmarkModelSQLHandler::Task::RemoveBookmark(const GURL& url) { | 55 void BookmarkModelSQLHandler::Task::RemoveBookmark(const GURL& url) { |
| 55 BookmarkModel* bookmark_model = GetBookmarkModel(); | 56 BookmarkModel* bookmark_model = GetBookmarkModel(); |
| 56 if (!bookmark_model) | 57 if (!bookmark_model) |
| 57 return; | 58 return; |
| 58 std::vector<const BookmarkNode*> nodes; | 59 std::vector<const BookmarkNode*> nodes; |
| 59 bookmark_model->GetNodesByURL(url, &nodes); | 60 bookmark_model->GetNodesByURL(url, &nodes); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 166 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| 166 &BookmarkModelSQLHandler::Task::AddBookmarkToMobileFolder, | 167 &BookmarkModelSQLHandler::Task::AddBookmarkToMobileFolder, |
| 167 scoped_refptr<BookmarkModelSQLHandler::Task>( | 168 scoped_refptr<BookmarkModelSQLHandler::Task>( |
| 168 new BookmarkModelSQLHandler::Task()), | 169 new BookmarkModelSQLHandler::Task()), |
| 169 row->url(), row->title())); | 170 row->url(), row->title())); |
| 170 } | 171 } |
| 171 return true; | 172 return true; |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace history | 175 } // namespace history |
| OLD | NEW |