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/android/provider/chrome_browser_provider.h" | 5 #include "chrome/browser/android/provider/chrome_browser_provider.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 int Run(const int64 id) { | 253 int Run(const int64 id) { |
254 id_to_delete_ = id; | 254 id_to_delete_ = id; |
255 RunOnUIThreadBlocking::Run( | 255 RunOnUIThreadBlocking::Run( |
256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id)); | 256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id)); |
257 return deleted_; | 257 return deleted_; |
258 } | 258 } |
259 | 259 |
260 static void RunOnUIThread(BookmarkModel* model, const int64 id) { | 260 static void RunOnUIThread(BookmarkModel* model, const int64 id) { |
261 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 261 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); | 262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); |
263 if (node && node->parent()) { | 263 if (node && node->parent()) |
264 const BookmarkNode* parent_node = node->parent(); | 264 model->Remove(node); |
265 model->Remove(parent_node, parent_node->GetIndexOf(node)); | |
266 } | |
267 } | 265 } |
268 | 266 |
269 // Verify that the bookmark was actually removed. Called synchronously. | 267 // Verify that the bookmark was actually removed. Called synchronously. |
270 void BookmarkNodeRemoved(BookmarkModel* bookmark_model, | 268 void BookmarkNodeRemoved(BookmarkModel* bookmark_model, |
271 const BookmarkNode* parent, | 269 const BookmarkNode* parent, |
272 int old_index, | 270 int old_index, |
273 const BookmarkNode* node, | 271 const BookmarkNode* node, |
274 const std::set<GURL>& removed_urls) override { | 272 const std::set<GURL>& removed_urls) override { |
275 if (bookmark_model == model() && node->id() == id_to_delete_) | 273 if (bookmark_model == model() && node->id() == id_to_delete_) |
276 ++deleted_; | 274 ++deleted_; |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); | 1641 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); |
1644 if (obj.is_null()) | 1642 if (obj.is_null()) |
1645 return; | 1643 return; |
1646 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); | 1644 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); |
1647 } | 1645 } |
1648 | 1646 |
1649 void ChromeBrowserProvider::OnKeywordSearchTermDeleted( | 1647 void ChromeBrowserProvider::OnKeywordSearchTermDeleted( |
1650 history::HistoryService* history_service, | 1648 history::HistoryService* history_service, |
1651 history::URLID url_id) { | 1649 history::URLID url_id) { |
1652 } | 1650 } |
OLD | NEW |