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

Side by Side Diff: components/translate/core/browser/translate_script.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, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/translate/core/browser/translate_script.h" 5 #include "components/translate/core/browser/translate_script.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h"
11 #include "base/profiler/scoped_tracker.h" 11 #include "base/profiler/scoped_tracker.h"
12 #include "base/single_thread_task_runner.h"
12 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/thread_task_runner_handle.h"
15 #include "components/translate/core/browser/translate_url_fetcher.h" 17 #include "components/translate/core/browser/translate_url_fetcher.h"
16 #include "components/translate/core/browser/translate_url_util.h" 18 #include "components/translate/core/browser/translate_url_util.h"
17 #include "components/translate/core/common/translate_switches.h" 19 #include "components/translate/core/common/translate_switches.h"
18 #include "components/translate/core/common/translate_util.h" 20 #include "components/translate/core/common/translate_util.h"
19 #include "google_apis/google_api_keys.h" 21 #include "google_apis/google_api_keys.h"
20 #include "grit/components_resources.h" 22 #include "grit/components_resources.h"
21 #include "net/base/escape.h" 23 #include "net/base/escape.h"
22 #include "net/base/url_util.h" 24 #include "net/base/url_util.h"
23 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
24 26
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 137
136 // Append embedded translate.js and a remote element library. 138 // Append embedded translate.js and a remote element library.
137 base::StringPiece str = ResourceBundle::GetSharedInstance(). 139 base::StringPiece str = ResourceBundle::GetSharedInstance().
138 GetRawDataResource(IDR_TRANSLATE_JS); 140 GetRawDataResource(IDR_TRANSLATE_JS);
139 str.AppendToString(&data_); 141 str.AppendToString(&data_);
140 data_ += data; 142 data_ += data;
141 143
142 // We'll expire the cached script after some time, to make sure long 144 // We'll expire the cached script after some time, to make sure long
143 // running browsers still get fixes that might get pushed with newer 145 // running browsers still get fixes that might get pushed with newer
144 // scripts. 146 // scripts.
145 base::MessageLoop::current()->PostDelayedTask( 147 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
146 FROM_HERE, 148 FROM_HERE,
147 base::Bind(&TranslateScript::Clear, 149 base::Bind(&TranslateScript::Clear, weak_method_factory_.GetWeakPtr()),
148 weak_method_factory_.GetWeakPtr()),
149 expiration_delay_); 150 expiration_delay_);
150 } 151 }
151 152
152 for (RequestCallbackList::iterator it = callback_list_.begin(); 153 for (RequestCallbackList::iterator it = callback_list_.begin();
153 it != callback_list_.end(); 154 it != callback_list_.end();
154 ++it) { 155 ++it) {
155 it->Run(success, data); 156 it->Run(success, data);
156 } 157 }
157 callback_list_.clear(); 158 callback_list_.clear();
158 } 159 }
159 160
160 } // namespace translate 161 } // namespace translate
OLDNEW
« no previous file with comments | « components/translate/content/renderer/translate_helper.cc ('k') | components/update_client/background_downloader_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698