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

Unified Diff: components/translate/content/browser/content_translate_driver.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/content/browser/content_translate_driver.cc
diff --git a/components/translate/content/browser/content_translate_driver.cc b/components/translate/content/browser/content_translate_driver.cc
index f2db0fb305491e7228a03634bf21800bb5c352ee..b650f31f7abefc2705ec87416cc24951128f096d 100644
--- a/components/translate/content/browser/content_translate_driver.cc
+++ b/components/translate/content/browser/content_translate_driver.cc
@@ -5,7 +5,10 @@
#include "components/translate/content/browser/content_translate_driver.h"
#include "base/bind.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "components/translate/content/common/translate_messages.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/translate/core/browser/translate_manager.h"
@@ -61,12 +64,10 @@ void ContentTranslateDriver::InitiateTranslation(const std::string& page_lang,
// has finished.
if (web_contents()->IsLoading() && attempt < max_reload_check_attempts_) {
int backoff = attempt * kMaxTranslateLoadCheckAttempts;
- base::MessageLoop::current()->PostDelayedTask(
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&ContentTranslateDriver::InitiateTranslation,
- weak_pointer_factory_.GetWeakPtr(),
- page_lang,
- attempt + 1),
+ weak_pointer_factory_.GetWeakPtr(), page_lang, attempt + 1),
base::TimeDelta::FromMilliseconds(backoff));
return;
}
@@ -197,7 +198,7 @@ void ContentTranslateDriver::NavigationEntryCommitted(
// by WebContentsObservers is undefined and might result in the current
// infobars being removed. Since the translation initiation process might add
// an infobar, it must be done after that.
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&ContentTranslateDriver::InitiateTranslation,
weak_pointer_factory_.GetWeakPtr(),
« no previous file with comments | « components/tracing/child_trace_message_filter.cc ('k') | components/translate/content/renderer/translate_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698