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

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

Issue 137263007: Move CancelableTaskTracker to //base/task/CancelableTaskTracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to base/task/cancelable_task_tracker* Created 6 years, 10 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 <list> 7 #include <list>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_array.h" 11 #include "base/android/jni_array.h"
12 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted_memory.h" 14 #include "base/memory/ref_counted_memory.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/task/cancelable_task_tracker.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "chrome/browser/android/provider/blocking_ui_thread_async_request.h" 18 #include "chrome/browser/android/provider/blocking_ui_thread_async_request.h"
18 #include "chrome/browser/android/provider/bookmark_model_observer_task.h" 19 #include "chrome/browser/android/provider/bookmark_model_observer_task.h"
19 #include "chrome/browser/android/provider/run_on_ui_thread_blocking.h" 20 #include "chrome/browser/android/provider/run_on_ui_thread_blocking.h"
20 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/favicon/favicon_service.h" 25 #include "chrome/browser/favicon/favicon_service.h"
25 #include "chrome/browser/favicon/favicon_service_factory.h" 26 #include "chrome/browser/favicon/favicon_service_factory.h"
26 #include "chrome/browser/history/android/android_history_types.h" 27 #include "chrome/browser/history/android/android_history_types.h"
27 #include "chrome/browser/history/android/sqlite_cursor.h" 28 #include "chrome/browser/history/android/sqlite_cursor.h"
28 #include "chrome/browser/history/top_sites.h" 29 #include "chrome/browser/history/top_sites.h"
29 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/profiles/profile_manager.h" 31 #include "chrome/browser/profiles/profile_manager.h"
31 #include "chrome/browser/search_engines/template_url.h" 32 #include "chrome/browser/search_engines/template_url.h"
32 #include "chrome/browser/search_engines/template_url_service.h" 33 #include "chrome/browser/search_engines/template_url_service.h"
33 #include "chrome/browser/search_engines/template_url_service_factory.h" 34 #include "chrome/browser/search_engines/template_url_service_factory.h"
34 #include "chrome/common/cancelable_task_tracker.h"
35 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
38 #include "jni/ChromeBrowserProvider_jni.h" 38 #include "jni/ChromeBrowserProvider_jni.h"
39 #include "sql/statement.h" 39 #include "sql/statement.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/base/layout.h" 41 #include "ui/base/layout.h"
42 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/gfx/favicon_size.h" 43 #include "ui/gfx/favicon_size.h"
44 44
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 DISALLOW_COPY_AND_ASSIGN(AsyncServiceRequest); 635 DISALLOW_COPY_AND_ASSIGN(AsyncServiceRequest);
636 }; 636 };
637 637
638 // Base class for all asynchronous blocking tasks that use the favicon service. 638 // Base class for all asynchronous blocking tasks that use the favicon service.
639 class FaviconServiceTask : public AsyncServiceRequest<FaviconService> { 639 class FaviconServiceTask : public AsyncServiceRequest<FaviconService> {
640 public: 640 public:
641 FaviconServiceTask(FaviconService* service, 641 FaviconServiceTask(FaviconService* service,
642 Profile* profile, 642 Profile* profile,
643 CancelableRequestConsumer* cancelable_consumer, 643 CancelableRequestConsumer* cancelable_consumer,
644 CancelableTaskTracker* cancelable_tracker) 644 base::CancelableTaskTracker* cancelable_tracker)
645 : AsyncServiceRequest<FaviconService>(service, cancelable_consumer), 645 : AsyncServiceRequest<FaviconService>(service, cancelable_consumer),
646 profile_(profile), 646 profile_(profile),
647 cancelable_tracker_(cancelable_tracker) {} 647 cancelable_tracker_(cancelable_tracker) {}
648 648
649 Profile* profile() const { return profile_; } 649 Profile* profile() const { return profile_; }
650 CancelableTaskTracker* cancelable_tracker() const { 650 base::CancelableTaskTracker* cancelable_tracker() const {
651 return cancelable_tracker_; 651 return cancelable_tracker_;
652 } 652 }
653 653
654 private: 654 private:
655 Profile* profile_; 655 Profile* profile_;
656 CancelableTaskTracker* cancelable_tracker_; 656 base::CancelableTaskTracker* cancelable_tracker_;
657 657
658 DISALLOW_COPY_AND_ASSIGN(FaviconServiceTask); 658 DISALLOW_COPY_AND_ASSIGN(FaviconServiceTask);
659 }; 659 };
660 660
661 // Retrieves the favicon or touch icon for a URL from the FaviconService. 661 // Retrieves the favicon or touch icon for a URL from the FaviconService.
662 class BookmarkIconFetchTask : public FaviconServiceTask { 662 class BookmarkIconFetchTask : public FaviconServiceTask {
663 public: 663 public:
664 BookmarkIconFetchTask( 664 BookmarkIconFetchTask(FaviconService* favicon_service,
665 FaviconService* favicon_service, 665 Profile* profile,
666 Profile* profile, 666 CancelableRequestConsumer* cancelable_consumer,
667 CancelableRequestConsumer* cancelable_consumer, 667 base::CancelableTaskTracker* cancelable_tracker)
668 CancelableTaskTracker* cancelable_tracker) 668 : FaviconServiceTask(favicon_service,
669 : FaviconServiceTask(favicon_service, profile, 669 profile,
670 cancelable_consumer, cancelable_tracker) {} 670 cancelable_consumer,
671 cancelable_tracker) {}
671 672
672 chrome::FaviconBitmapResult Run(const GURL& url) { 673 chrome::FaviconBitmapResult Run(const GURL& url) {
673 RunAsyncRequestOnUIThreadBlocking( 674 RunAsyncRequestOnUIThreadBlocking(
674 base::Bind(&FaviconService::GetRawFaviconForURL, 675 base::Bind(&FaviconService::GetRawFaviconForURL,
675 base::Unretained(service()), 676 base::Unretained(service()),
676 FaviconService::FaviconForURLParams( 677 FaviconService::FaviconForURLParams(
677 url, 678 url,
678 chrome::FAVICON | chrome::TOUCH_ICON, 679 chrome::FAVICON | chrome::TOUCH_ICON,
679 gfx::kFaviconSize), 680 gfx::kFaviconSize),
680 ResourceBundle::GetSharedInstance().GetMaxScaleFactor(), 681 ResourceBundle::GetSharedInstance().GetMaxScaleFactor(),
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj()); 1614 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj());
1614 } else if (type == 1615 } else if (type ==
1615 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { 1616 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) {
1616 JNIEnv* env = AttachCurrentThread(); 1617 JNIEnv* env = AttachCurrentThread();
1617 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); 1618 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1618 if (obj.is_null()) 1619 if (obj.is_null())
1619 return; 1620 return;
1620 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); 1621 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1621 } 1622 }
1622 } 1623 }
OLDNEW
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.h ('k') | chrome/browser/android/shortcut_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698