| 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 "base/macros.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "components/bookmarks/browser/bookmark_model.h" | 11 #include "components/bookmarks/browser/bookmark_model.h" |
| 11 #include "components/bookmarks/browser/bookmark_utils.h" | 12 #include "components/bookmarks/browser/bookmark_utils.h" |
| 12 #include "components/history/core/browser/url_database.h" | 13 #include "components/history/core/browser/url_database.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 | 15 |
| 15 using base::Time; | 16 using base::Time; |
| 16 using bookmarks::BookmarkModel; | 17 using bookmarks::BookmarkModel; |
| 17 using bookmarks::BookmarkNode; | 18 using bookmarks::BookmarkNode; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 BookmarkModel* bookmark_model = GetBookmarkModel(); | 37 BookmarkModel* bookmark_model = GetBookmarkModel(); |
| 37 if (!bookmark_model) | 38 if (!bookmark_model) |
| 38 return; | 39 return; |
| 39 const BookmarkNode* mobile_node = bookmark_model->mobile_node(); | 40 const BookmarkNode* mobile_node = bookmark_model->mobile_node(); |
| 40 if (mobile_node) | 41 if (mobile_node) |
| 41 bookmark_model->AddURL(mobile_node, 0, title, url); | 42 bookmark_model->AddURL(mobile_node, 0, title, url); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, | 45 void BookmarkModelSQLHandler::Task::AddBookmark(const GURL& url, |
| 45 const base::string16& title, | 46 const base::string16& title, |
| 46 int64 parent_id) { | 47 int64_t parent_id) { |
| 47 BookmarkModel* bookmark_model = GetBookmarkModel(); | 48 BookmarkModel* bookmark_model = GetBookmarkModel(); |
| 48 if (!bookmark_model) | 49 if (!bookmark_model) |
| 49 return; | 50 return; |
| 50 const BookmarkNode* parent = | 51 const BookmarkNode* parent = |
| 51 bookmarks::GetBookmarkNodeByID(bookmark_model, parent_id); | 52 bookmarks::GetBookmarkNodeByID(bookmark_model, parent_id); |
| 52 if (parent) | 53 if (parent) |
| 53 bookmark_model->AddURL(parent, 0, title, url); | 54 bookmark_model->AddURL(parent, 0, title, url); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void BookmarkModelSQLHandler::Task::RemoveBookmark(const GURL& url) { | 57 void BookmarkModelSQLHandler::Task::RemoveBookmark(const GURL& url) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 167 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| 167 &BookmarkModelSQLHandler::Task::AddBookmarkToMobileFolder, | 168 &BookmarkModelSQLHandler::Task::AddBookmarkToMobileFolder, |
| 168 scoped_refptr<BookmarkModelSQLHandler::Task>( | 169 scoped_refptr<BookmarkModelSQLHandler::Task>( |
| 169 new BookmarkModelSQLHandler::Task()), | 170 new BookmarkModelSQLHandler::Task()), |
| 170 row->url(), row->title())); | 171 row->url(), row->title())); |
| 171 } | 172 } |
| 172 return true; | 173 return true; |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace history | 176 } // namespace history |
| OLD | NEW |