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

Side by Side Diff: components/translate/content/browser/content_translate_driver.cc

Issue 2897573002: remove offline check (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/content/browser/content_translate_driver.h" 5 #include "components/translate/content/browser/content_translate_driver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "components/translate/core/browser/translate_download_manager.h" 12 #include "components/translate/core/browser/translate_download_manager.h"
13 #include "components/translate/core/browser/translate_manager.h" 13 #include "components/translate/core/browser/translate_manager.h"
14 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/navigation_controller.h" 15 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/navigation_details.h" 16 #include "content/public/browser/navigation_details.h"
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/navigation_handle.h" 18 #include "content/public/browser/navigation_handle.h"
19 #include "content/public/browser/page_navigator.h" 19 #include "content/public/browser/page_navigator.h"
20 #include "content/public/browser/render_frame_host.h" 20 #include "content/public/browser/render_frame_host.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/referrer.h" 22 #include "content/public/common/referrer.h"
23 #include "net/base/network_change_notifier.h"
24 #include "net/http/http_status_code.h" 23 #include "net/http/http_status_code.h"
25 #include "url/gurl.h" 24 #include "url/gurl.h"
26 25
27 namespace { 26 namespace {
28 27
29 // The maximum number of attempts we'll do to see if the page has finshed 28 // The maximum number of attempts we'll do to see if the page has finshed
30 // loading before giving up the translation 29 // loading before giving up the translation
31 const int kMaxTranslateLoadCheckAttempts = 20; 30 const int kMaxTranslateLoadCheckAttempts = 20;
32 31
33 } // namespace 32 } // namespace
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 252 }
254 253
255 void ContentTranslateDriver::OnPageTranslated( 254 void ContentTranslateDriver::OnPageTranslated(
256 bool cancelled, 255 bool cancelled,
257 const std::string& original_lang, 256 const std::string& original_lang,
258 const std::string& translated_lang, 257 const std::string& translated_lang,
259 TranslateErrors::Type error_type) { 258 TranslateErrors::Type error_type) {
260 if (cancelled) 259 if (cancelled)
261 return; 260 return;
262 261
263 if (net::NetworkChangeNotifier::IsOffline()) {
264 error_type = TranslateErrors::NETWORK;
265 }
266
267 translate_manager_->PageTranslated( 262 translate_manager_->PageTranslated(
268 original_lang, translated_lang, error_type); 263 original_lang, translated_lang, error_type);
269 for (auto& observer : observer_list_) 264 for (auto& observer : observer_list_)
270 observer.OnPageTranslated(original_lang, translated_lang, error_type); 265 observer.OnPageTranslated(original_lang, translated_lang, error_type);
271 } 266 }
272 267
273 } // namespace translate 268 } // namespace translate
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698