| 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.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_service.h" | 10 #include "chrome/browser/bookmarks/bookmark_service.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/history/url_database.h" | 13 #include "chrome/browser/history/url_database.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 | 16 |
| 16 using base::Time; | 17 using base::Time; |
| 17 using content::BrowserThread; | 18 using content::BrowserThread; |
| 18 | 19 |
| 19 namespace history { | 20 namespace history { |
| 20 | 21 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 if (mobile_node) | 40 if (mobile_node) |
| 40 bookmark_model->AddURL(mobile_node, 0, title, url); | 41 bookmark_model->AddURL(mobile_node, 0, title, url); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, | 44 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, |
| 44 const base::string16& title, | 45 const base::string16& title, |
| 45 int64 parent_id) { | 46 int64 parent_id) { |
| 46 BookmarkModel* bookmark_model = GetBookmarkModel(); | 47 BookmarkModel* bookmark_model = GetBookmarkModel(); |
| 47 if (!bookmark_model) | 48 if (!bookmark_model) |
| 48 return; | 49 return; |
| 49 const BookmarkNode* parent = bookmark_model->GetNodeByID(parent_id); | 50 const BookmarkNode* parent = 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 |