Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 1542413002: Switch to standard integer types in chrome/browser/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h>
8
7 #include <cmath> 9 #include <cmath>
8 #include <list> 10 #include <list>
9 #include <utility> 11 #include <utility>
10 12
11 #include "base/android/jni_android.h" 13 #include "base/android/jni_android.h"
12 #include "base/android/jni_array.h" 14 #include "base/android/jni_array.h"
13 #include "base/android/jni_string.h" 15 #include "base/android/jni_string.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h"
15 #include "base/memory/ref_counted_memory.h" 18 #include "base/memory/ref_counted_memory.h"
16 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
17 #include "base/task/cancelable_task_tracker.h" 20 #include "base/task/cancelable_task_tracker.h"
18 #include "base/time/time.h" 21 #include "base/time/time.h"
19 #include "chrome/browser/android/provider/blocking_ui_thread_async_request.h" 22 #include "chrome/browser/android/provider/blocking_ui_thread_async_request.h"
20 #include "chrome/browser/android/provider/bookmark_model_observer_task.h" 23 #include "chrome/browser/android/provider/bookmark_model_observer_task.h"
21 #include "chrome/browser/android/provider/run_on_ui_thread_blocking.h" 24 #include "chrome/browser/android/provider/run_on_ui_thread_blocking.h"
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
23 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 26 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
24 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // 92 //
90 // - HistoryProviderTask: base class for asynchronous requests that make use of 93 // - HistoryProviderTask: base class for asynchronous requests that make use of
91 // AndroidHistoryProviderService. See AsyncServiceRequest for mode details. 94 // AndroidHistoryProviderService. See AsyncServiceRequest for mode details.
92 // 95 //
93 // - SearchTermTask: base class for asynchronous requests that involve the 96 // - SearchTermTask: base class for asynchronous requests that involve the
94 // search term API. Works in the same way as HistoryProviderTask. 97 // search term API. Works in the same way as HistoryProviderTask.
95 98
96 namespace { 99 namespace {
97 100
98 const char kDefaultUrlScheme[] = "http://"; 101 const char kDefaultUrlScheme[] = "http://";
99 const int64 kInvalidContentProviderId = 0; 102 const int64_t kInvalidContentProviderId = 0;
100 const int64 kInvalidBookmarkId = -1; 103 const int64_t kInvalidBookmarkId = -1;
101 104
102 // ------------- Java-related utility methods ------------- // 105 // ------------- Java-related utility methods ------------- //
103 106
104 // Convert a BookmarkNode, |node|, to the java representation of a bookmark node 107 // Convert a BookmarkNode, |node|, to the java representation of a bookmark node
105 // stored in |*jnode|. Parent node information is optional. 108 // stored in |*jnode|. Parent node information is optional.
106 void ConvertBookmarkNode( 109 void ConvertBookmarkNode(
107 const BookmarkNode* node, 110 const BookmarkNode* node,
108 const JavaRef<jobject>& parent_node, 111 const JavaRef<jobject>& parent_node,
109 ScopedJavaGlobalRef<jobject>* jnode) { 112 ScopedJavaGlobalRef<jobject>* jnode) {
110 DCHECK(jnode); 113 DCHECK(jnode);
(...skipping 23 matching lines...) Expand all
134 jboolean ConvertJBooleanObjectToPrimitive(JNIEnv* env, jobject boolean_object) { 137 jboolean ConvertJBooleanObjectToPrimitive(JNIEnv* env, jobject boolean_object) {
135 ScopedJavaLocalRef<jclass> jboolean_clazz = 138 ScopedJavaLocalRef<jclass> jboolean_clazz =
136 GetClass(env, "java/lang/Boolean"); 139 GetClass(env, "java/lang/Boolean");
137 jmethodID boolean_value = MethodID::Get<MethodID::TYPE_INSTANCE>( 140 jmethodID boolean_value = MethodID::Get<MethodID::TYPE_INSTANCE>(
138 env, jboolean_clazz.obj(), "booleanValue", "()Z"); 141 env, jboolean_clazz.obj(), "booleanValue", "()Z");
139 return env->CallBooleanMethod(boolean_object, boolean_value, NULL); 142 return env->CallBooleanMethod(boolean_object, boolean_value, NULL);
140 } 143 }
141 144
142 base::Time ConvertJlongToTime(jlong value) { 145 base::Time ConvertJlongToTime(jlong value) {
143 return base::Time::UnixEpoch() + 146 return base::Time::UnixEpoch() +
144 base::TimeDelta::FromMilliseconds((int64)value); 147 base::TimeDelta::FromMilliseconds((int64_t)value);
145 } 148 }
146 149
147 jint ConvertJIntegerToJint(JNIEnv* env, jobject integer_obj) { 150 jint ConvertJIntegerToJint(JNIEnv* env, jobject integer_obj) {
148 ScopedJavaLocalRef<jclass> jinteger_clazz = 151 ScopedJavaLocalRef<jclass> jinteger_clazz =
149 GetClass(env, "java/lang/Integer"); 152 GetClass(env, "java/lang/Integer");
150 jmethodID int_value = MethodID::Get<MethodID::TYPE_INSTANCE>( 153 jmethodID int_value = MethodID::Get<MethodID::TYPE_INSTANCE>(
151 env, jinteger_clazz.obj(), "intValue", "()I"); 154 env, jinteger_clazz.obj(), "intValue", "()I");
152 return env->CallIntMethod(integer_obj, int_value, NULL); 155 return env->CallIntMethod(integer_obj, int_value, NULL);
153 } 156 }
154 157
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return NULL; 195 return NULL;
193 } 196 }
194 197
195 // ------------- Synchronous task classes ------------- // 198 // ------------- Synchronous task classes ------------- //
196 199
197 // Utility task to add a bookmark. 200 // Utility task to add a bookmark.
198 class AddBookmarkTask : public BookmarkModelTask { 201 class AddBookmarkTask : public BookmarkModelTask {
199 public: 202 public:
200 explicit AddBookmarkTask(BookmarkModel* model) : BookmarkModelTask(model) {} 203 explicit AddBookmarkTask(BookmarkModel* model) : BookmarkModelTask(model) {}
201 204
202 int64 Run(const base::string16& title, 205 int64_t Run(const base::string16& title,
203 const base::string16& url, 206 const base::string16& url,
204 const bool is_folder, 207 const bool is_folder,
205 const int64 parent_id) { 208 const int64_t parent_id) {
206 int64 result = kInvalidBookmarkId; 209 int64_t result = kInvalidBookmarkId;
207 RunOnUIThreadBlocking::Run( 210 RunOnUIThreadBlocking::Run(
208 base::Bind(&AddBookmarkTask::RunOnUIThread, 211 base::Bind(&AddBookmarkTask::RunOnUIThread,
209 model(), title, url, is_folder, parent_id, &result)); 212 model(), title, url, is_folder, parent_id, &result));
210 return result; 213 return result;
211 } 214 }
212 215
213 static void RunOnUIThread(BookmarkModel* model, 216 static void RunOnUIThread(BookmarkModel* model,
214 const base::string16& title, 217 const base::string16& title,
215 const base::string16& url, 218 const base::string16& url,
216 const bool is_folder, 219 const bool is_folder,
217 const int64 parent_id, 220 const int64_t parent_id,
218 int64* result) { 221 int64_t* result) {
219 DCHECK_CURRENTLY_ON(BrowserThread::UI); 222 DCHECK_CURRENTLY_ON(BrowserThread::UI);
220 DCHECK(result); 223 DCHECK(result);
221 GURL gurl = ParseAndMaybeAppendScheme(url, kDefaultUrlScheme); 224 GURL gurl = ParseAndMaybeAppendScheme(url, kDefaultUrlScheme);
222 225
223 // Check if the bookmark already exists. 226 // Check if the bookmark already exists.
224 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(gurl); 227 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(gurl);
225 if (!node) { 228 if (!node) {
226 const BookmarkNode* parent_node = NULL; 229 const BookmarkNode* parent_node = NULL;
227 if (parent_id >= 0) 230 if (parent_id >= 0)
228 parent_node = bookmarks::GetBookmarkNodeByID(model, parent_id); 231 parent_node = bookmarks::GetBookmarkNodeByID(model, parent_id);
(...skipping 15 matching lines...) Expand all
244 247
245 // Utility method to remove a bookmark. 248 // Utility method to remove a bookmark.
246 class RemoveBookmarkTask : public BookmarkModelObserverTask { 249 class RemoveBookmarkTask : public BookmarkModelObserverTask {
247 public: 250 public:
248 explicit RemoveBookmarkTask(BookmarkModel* model) 251 explicit RemoveBookmarkTask(BookmarkModel* model)
249 : BookmarkModelObserverTask(model), 252 : BookmarkModelObserverTask(model),
250 deleted_(0), 253 deleted_(0),
251 id_to_delete_(kInvalidBookmarkId) {} 254 id_to_delete_(kInvalidBookmarkId) {}
252 ~RemoveBookmarkTask() override {} 255 ~RemoveBookmarkTask() override {}
253 256
254 int Run(const int64 id) { 257 int Run(const int64_t id) {
255 id_to_delete_ = id; 258 id_to_delete_ = id;
256 RunOnUIThreadBlocking::Run( 259 RunOnUIThreadBlocking::Run(
257 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id)); 260 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id));
258 return deleted_; 261 return deleted_;
259 } 262 }
260 263
261 static void RunOnUIThread(BookmarkModel* model, const int64 id) { 264 static void RunOnUIThread(BookmarkModel* model, const int64_t id) {
262 DCHECK_CURRENTLY_ON(BrowserThread::UI); 265 DCHECK_CURRENTLY_ON(BrowserThread::UI);
263 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 266 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
264 if (node && node->parent()) 267 if (node && node->parent())
265 model->Remove(node); 268 model->Remove(node);
266 } 269 }
267 270
268 // Verify that the bookmark was actually removed. Called synchronously. 271 // Verify that the bookmark was actually removed. Called synchronously.
269 void BookmarkNodeRemoved(BookmarkModel* bookmark_model, 272 void BookmarkNodeRemoved(BookmarkModel* bookmark_model,
270 const BookmarkNode* parent, 273 const BookmarkNode* parent,
271 int old_index, 274 int old_index,
272 const BookmarkNode* node, 275 const BookmarkNode* node,
273 const std::set<GURL>& removed_urls) override { 276 const std::set<GURL>& removed_urls) override {
274 if (bookmark_model == model() && node->id() == id_to_delete_) 277 if (bookmark_model == model() && node->id() == id_to_delete_)
275 ++deleted_; 278 ++deleted_;
276 } 279 }
277 280
278 private: 281 private:
279 int deleted_; 282 int deleted_;
280 int64 id_to_delete_; 283 int64_t id_to_delete_;
281 284
282 DISALLOW_COPY_AND_ASSIGN(RemoveBookmarkTask); 285 DISALLOW_COPY_AND_ASSIGN(RemoveBookmarkTask);
283 }; 286 };
284 287
285 // Utility method to remove all bookmarks that the user can edit. 288 // Utility method to remove all bookmarks that the user can edit.
286 class RemoveAllUserBookmarksTask : public BookmarkModelObserverTask { 289 class RemoveAllUserBookmarksTask : public BookmarkModelObserverTask {
287 public: 290 public:
288 explicit RemoveAllUserBookmarksTask(BookmarkModel* model) 291 explicit RemoveAllUserBookmarksTask(BookmarkModel* model)
289 : BookmarkModelObserverTask(model) {} 292 : BookmarkModelObserverTask(model) {}
290 293
(...skipping 17 matching lines...) Expand all
308 311
309 // Utility method to update a bookmark. 312 // Utility method to update a bookmark.
310 class UpdateBookmarkTask : public BookmarkModelObserverTask { 313 class UpdateBookmarkTask : public BookmarkModelObserverTask {
311 public: 314 public:
312 explicit UpdateBookmarkTask(BookmarkModel* model) 315 explicit UpdateBookmarkTask(BookmarkModel* model)
313 : BookmarkModelObserverTask(model), 316 : BookmarkModelObserverTask(model),
314 updated_(0), 317 updated_(0),
315 id_to_update_(kInvalidBookmarkId){} 318 id_to_update_(kInvalidBookmarkId){}
316 ~UpdateBookmarkTask() override {} 319 ~UpdateBookmarkTask() override {}
317 320
318 int Run(const int64 id, 321 int Run(const int64_t id,
319 const base::string16& title, 322 const base::string16& title,
320 const base::string16& url, 323 const base::string16& url,
321 const int64 parent_id) { 324 const int64_t parent_id) {
322 id_to_update_ = id; 325 id_to_update_ = id;
323 RunOnUIThreadBlocking::Run( 326 RunOnUIThreadBlocking::Run(
324 base::Bind(&UpdateBookmarkTask::RunOnUIThread, 327 base::Bind(&UpdateBookmarkTask::RunOnUIThread,
325 model(), id, title, url, parent_id)); 328 model(), id, title, url, parent_id));
326 return updated_; 329 return updated_;
327 } 330 }
328 331
329 static void RunOnUIThread(BookmarkModel* model, 332 static void RunOnUIThread(BookmarkModel* model,
330 const int64 id, 333 const int64_t id,
331 const base::string16& title, 334 const base::string16& title,
332 const base::string16& url, 335 const base::string16& url,
333 const int64 parent_id) { 336 const int64_t parent_id) {
334 DCHECK_CURRENTLY_ON(BrowserThread::UI); 337 DCHECK_CURRENTLY_ON(BrowserThread::UI);
335 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 338 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
336 if (node) { 339 if (node) {
337 if (node->GetTitle() != title) 340 if (node->GetTitle() != title)
338 model->SetTitle(node, title); 341 model->SetTitle(node, title);
339 342
340 if (node->type() == BookmarkNode::URL) { 343 if (node->type() == BookmarkNode::URL) {
341 GURL bookmark_url = ParseAndMaybeAppendScheme(url, kDefaultUrlScheme); 344 GURL bookmark_url = ParseAndMaybeAppendScheme(url, kDefaultUrlScheme);
342 if (bookmark_url != node->url()) 345 if (bookmark_url != node->url())
343 model->SetURL(node, bookmark_url); 346 model->SetURL(node, bookmark_url);
(...skipping 12 matching lines...) Expand all
356 359
357 // Verify that the bookmark was actually updated. Called synchronously. 360 // Verify that the bookmark was actually updated. Called synchronously.
358 void BookmarkNodeChanged(BookmarkModel* bookmark_model, 361 void BookmarkNodeChanged(BookmarkModel* bookmark_model,
359 const BookmarkNode* node) override { 362 const BookmarkNode* node) override {
360 if (bookmark_model == model() && node->id() == id_to_update_) 363 if (bookmark_model == model() && node->id() == id_to_update_)
361 ++updated_; 364 ++updated_;
362 } 365 }
363 366
364 private: 367 private:
365 int updated_; 368 int updated_;
366 int64 id_to_update_; 369 int64_t id_to_update_;
367 370
368 DISALLOW_COPY_AND_ASSIGN(UpdateBookmarkTask); 371 DISALLOW_COPY_AND_ASSIGN(UpdateBookmarkTask);
369 }; 372 };
370 373
371 // Checks if a node exists in the bookmark model. 374 // Checks if a node exists in the bookmark model.
372 class BookmarkNodeExistsTask : public BookmarkModelTask { 375 class BookmarkNodeExistsTask : public BookmarkModelTask {
373 public: 376 public:
374 explicit BookmarkNodeExistsTask(BookmarkModel* model) 377 explicit BookmarkNodeExistsTask(BookmarkModel* model)
375 : BookmarkModelTask(model) { 378 : BookmarkModelTask(model) {
376 } 379 }
377 380
378 bool Run(const int64 id) { 381 bool Run(const int64_t id) {
379 bool result = false; 382 bool result = false;
380 RunOnUIThreadBlocking::Run( 383 RunOnUIThreadBlocking::Run(
381 base::Bind(&BookmarkNodeExistsTask::RunOnUIThread, 384 base::Bind(&BookmarkNodeExistsTask::RunOnUIThread,
382 model(), id, &result)); 385 model(), id, &result));
383 return result; 386 return result;
384 } 387 }
385 388
386 static void RunOnUIThread(BookmarkModel* model, 389 static void RunOnUIThread(BookmarkModel* model,
387 const int64 id, 390 const int64_t id,
388 bool* result) { 391 bool* result) {
389 DCHECK_CURRENTLY_ON(BrowserThread::UI); 392 DCHECK_CURRENTLY_ON(BrowserThread::UI);
390 DCHECK(result); 393 DCHECK(result);
391 *result = bookmarks::GetBookmarkNodeByID(model, id) != NULL; 394 *result = bookmarks::GetBookmarkNodeByID(model, id) != NULL;
392 } 395 }
393 396
394 private: 397 private:
395 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeExistsTask); 398 DISALLOW_COPY_AND_ASSIGN(BookmarkNodeExistsTask);
396 }; 399 };
397 400
398 // Checks if a node belongs to the Mobile Bookmarks hierarchy branch. 401 // Checks if a node belongs to the Mobile Bookmarks hierarchy branch.
399 class IsInMobileBookmarksBranchTask : public BookmarkModelTask { 402 class IsInMobileBookmarksBranchTask : public BookmarkModelTask {
400 public: 403 public:
401 explicit IsInMobileBookmarksBranchTask(BookmarkModel* model) 404 explicit IsInMobileBookmarksBranchTask(BookmarkModel* model)
402 : BookmarkModelTask(model) {} 405 : BookmarkModelTask(model) {}
403 406
404 bool Run(const int64 id) { 407 bool Run(const int64_t id) {
405 bool result = false; 408 bool result = false;
406 RunOnUIThreadBlocking::Run( 409 RunOnUIThreadBlocking::Run(
407 base::Bind(&IsInMobileBookmarksBranchTask::RunOnUIThread, 410 base::Bind(&IsInMobileBookmarksBranchTask::RunOnUIThread,
408 model(), id, &result)); 411 model(), id, &result));
409 return result; 412 return result;
410 } 413 }
411 414
412 static void RunOnUIThread(BookmarkModel* model, 415 static void RunOnUIThread(BookmarkModel* model,
413 const int64 id, 416 const int64_t id,
414 bool *result) { 417 bool* result) {
415 DCHECK_CURRENTLY_ON(BrowserThread::UI); 418 DCHECK_CURRENTLY_ON(BrowserThread::UI);
416 DCHECK(result); 419 DCHECK(result);
417 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 420 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
418 const BookmarkNode* mobile_node = model->mobile_node(); 421 const BookmarkNode* mobile_node = model->mobile_node();
419 while (node && node != mobile_node) 422 while (node && node != mobile_node)
420 node = node->parent(); 423 node = node->parent();
421 424
422 *result = node == mobile_node; 425 *result = node == mobile_node;
423 } 426 }
424 427
425 private: 428 private:
426 DISALLOW_COPY_AND_ASSIGN(IsInMobileBookmarksBranchTask); 429 DISALLOW_COPY_AND_ASSIGN(IsInMobileBookmarksBranchTask);
427 }; 430 };
428 431
429 // Creates folder or retrieves its id if already exists. 432 // Creates folder or retrieves its id if already exists.
430 // An invalid parent id is assumed to represent the Mobile Bookmarks folder. 433 // An invalid parent id is assumed to represent the Mobile Bookmarks folder.
431 // Can only be used to create folders inside the Mobile Bookmarks branch. 434 // Can only be used to create folders inside the Mobile Bookmarks branch.
432 class CreateBookmarksFolderOnceTask : public BookmarkModelTask { 435 class CreateBookmarksFolderOnceTask : public BookmarkModelTask {
433 public: 436 public:
434 explicit CreateBookmarksFolderOnceTask(BookmarkModel* model) 437 explicit CreateBookmarksFolderOnceTask(BookmarkModel* model)
435 : BookmarkModelTask(model) {} 438 : BookmarkModelTask(model) {}
436 439
437 int64 Run(const base::string16& title, const int64 parent_id) { 440 int64_t Run(const base::string16& title, const int64_t parent_id) {
438 int64 result = kInvalidBookmarkId; 441 int64_t result = kInvalidBookmarkId;
439 RunOnUIThreadBlocking::Run( 442 RunOnUIThreadBlocking::Run(
440 base::Bind(&CreateBookmarksFolderOnceTask::RunOnUIThread, 443 base::Bind(&CreateBookmarksFolderOnceTask::RunOnUIThread,
441 model(), title, parent_id, &result)); 444 model(), title, parent_id, &result));
442 return result; 445 return result;
443 } 446 }
444 447
445 static void RunOnUIThread(BookmarkModel* model, 448 static void RunOnUIThread(BookmarkModel* model,
446 const base::string16& title, 449 const base::string16& title,
447 const int64 parent_id, 450 const int64_t parent_id,
448 int64* result) { 451 int64_t* result) {
449 DCHECK_CURRENTLY_ON(BrowserThread::UI); 452 DCHECK_CURRENTLY_ON(BrowserThread::UI);
450 DCHECK(result); 453 DCHECK(result);
451 454
452 // Invalid ids are assumed to refer to the Mobile Bookmarks folder. 455 // Invalid ids are assumed to refer to the Mobile Bookmarks folder.
453 const BookmarkNode* parent = 456 const BookmarkNode* parent =
454 parent_id >= 0 ? bookmarks::GetBookmarkNodeByID(model, parent_id) 457 parent_id >= 0 ? bookmarks::GetBookmarkNodeByID(model, parent_id)
455 : model->mobile_node(); 458 : model->mobile_node();
456 DCHECK(parent); 459 DCHECK(parent);
457 460
458 bool in_mobile_bookmarks; 461 bool in_mobile_bookmarks;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 DISALLOW_COPY_AND_ASSIGN(GetEditableBookmarkFoldersTask); 544 DISALLOW_COPY_AND_ASSIGN(GetEditableBookmarkFoldersTask);
542 }; 545 };
543 546
544 // Creates a Java BookmarkNode object for a node given its id. 547 // Creates a Java BookmarkNode object for a node given its id.
545 class GetBookmarkNodeTask : public BookmarkModelTask { 548 class GetBookmarkNodeTask : public BookmarkModelTask {
546 public: 549 public:
547 explicit GetBookmarkNodeTask(BookmarkModel* model) 550 explicit GetBookmarkNodeTask(BookmarkModel* model)
548 : BookmarkModelTask(model) { 551 : BookmarkModelTask(model) {
549 } 552 }
550 553
551 void Run(const int64 id, 554 void Run(const int64_t id,
552 bool get_parent, 555 bool get_parent,
553 bool get_children, 556 bool get_children,
554 ScopedJavaGlobalRef<jobject>* jnode) { 557 ScopedJavaGlobalRef<jobject>* jnode) {
555 return RunOnUIThreadBlocking::Run( 558 return RunOnUIThreadBlocking::Run(
556 base::Bind(&GetBookmarkNodeTask::RunOnUIThread, 559 base::Bind(&GetBookmarkNodeTask::RunOnUIThread,
557 model(), id, get_parent, get_children, jnode)); 560 model(), id, get_parent, get_children, jnode));
558 } 561 }
559 562
560 static void RunOnUIThread(BookmarkModel* model, 563 static void RunOnUIThread(BookmarkModel* model,
561 const int64 id, 564 const int64_t id,
562 bool get_parent, 565 bool get_parent,
563 bool get_children, 566 bool get_children,
564 ScopedJavaGlobalRef<jobject>* jnode) { 567 ScopedJavaGlobalRef<jobject>* jnode) {
565 DCHECK_CURRENTLY_ON(BrowserThread::UI); 568 DCHECK_CURRENTLY_ON(BrowserThread::UI);
566 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 569 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
567 if (!node || !jnode) 570 if (!node || !jnode)
568 return; 571 return;
569 572
570 ScopedJavaGlobalRef<jobject> jparent; 573 ScopedJavaGlobalRef<jobject> jparent;
571 if (get_parent) { 574 if (get_parent) {
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 ConvertJLongObjectToPrimitive(env, created))); 1111 ConvertJLongObjectToPrimitive(env, created)));
1109 1112
1110 if (isBookmark) 1113 if (isBookmark)
1111 row->set_is_bookmark(ConvertJBooleanObjectToPrimitive(env, isBookmark)); 1114 row->set_is_bookmark(ConvertJBooleanObjectToPrimitive(env, isBookmark));
1112 1115
1113 if (date) 1116 if (date)
1114 row->set_last_visit_time(ConvertJlongToTime(ConvertJLongObjectToPrimitive( 1117 row->set_last_visit_time(ConvertJlongToTime(ConvertJLongObjectToPrimitive(
1115 env, date))); 1118 env, date)));
1116 1119
1117 if (favicon) { 1120 if (favicon) {
1118 std::vector<uint8> bytes; 1121 std::vector<uint8_t> bytes;
1119 base::android::JavaByteArrayToByteVector(env, favicon, &bytes); 1122 base::android::JavaByteArrayToByteVector(env, favicon, &bytes);
1120 row->set_favicon(base::RefCountedBytes::TakeVector(&bytes)); 1123 row->set_favicon(base::RefCountedBytes::TakeVector(&bytes));
1121 } 1124 }
1122 1125
1123 if (title) 1126 if (title)
1124 row->set_title(ConvertJavaStringToUTF16(env, title)); 1127 row->set_title(ConvertJavaStringToUTF16(env, title));
1125 1128
1126 if (visits) 1129 if (visits)
1127 row->set_visit_count(ConvertJIntegerToJint(env, visits)); 1130 row->set_visit_count(ConvertJIntegerToJint(env, visits));
1128 1131
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); 1670 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1668 if (obj.is_null()) 1671 if (obj.is_null())
1669 return; 1672 return;
1670 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); 1673 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1671 } 1674 }
1672 1675
1673 void ChromeBrowserProvider::OnKeywordSearchTermDeleted( 1676 void ChromeBrowserProvider::OnKeywordSearchTermDeleted(
1674 history::HistoryService* history_service, 1677 history::HistoryService* history_service,
1675 history::URLID url_id) { 1678 history::URLID url_id) {
1676 } 1679 }
OLDNEW
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.h ('k') | chrome/browser/android/recently_closed_tabs_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698