OLD | NEW |
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/translate/translate_manager.h" | 5 #include "chrome/browser/translate/translate_manager.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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 base::StringPrintf( | 832 base::StringPrintf( |
833 kLanguageListFetchURL, | 833 kLanguageListFetchURL, |
834 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str())); | 834 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str())); |
835 AddApiKeyToUrl(&language_list_fetch_url); | 835 AddApiKeyToUrl(&language_list_fetch_url); |
836 language_list_request_pending_.reset(net::URLFetcher::Create( | 836 language_list_request_pending_.reset(net::URLFetcher::Create( |
837 1, language_list_fetch_url, net::URLFetcher::GET, this)); | 837 1, language_list_fetch_url, net::URLFetcher::GET, this)); |
838 language_list_request_pending_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 838 language_list_request_pending_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
839 net::LOAD_DO_NOT_SAVE_COOKIES); | 839 net::LOAD_DO_NOT_SAVE_COOKIES); |
840 language_list_request_pending_->SetRequestContext( | 840 language_list_request_pending_->SetRequestContext( |
841 g_browser_process->system_request_context()); | 841 g_browser_process->system_request_context()); |
842 language_list_request_pending_->SetMaxRetries(kMaxRetryLanguageListFetch); | 842 language_list_request_pending_->SetMaxRetriesOn5xx( |
| 843 kMaxRetryLanguageListFetch); |
843 language_list_request_pending_->Start(); | 844 language_list_request_pending_->Start(); |
844 } | 845 } |
845 | 846 |
846 void TranslateManager::CleanupPendingUlrFetcher() { | 847 void TranslateManager::CleanupPendingUlrFetcher() { |
847 language_list_request_pending_.reset(); | 848 language_list_request_pending_.reset(); |
848 translate_script_request_pending_.reset(); | 849 translate_script_request_pending_.reset(); |
849 } | 850 } |
850 | 851 |
851 void TranslateManager::RequestTranslateScript() { | 852 void TranslateManager::RequestTranslateScript() { |
852 if (translate_script_request_pending_.get() != NULL) | 853 if (translate_script_request_pending_.get() != NULL) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 921 |
921 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { | 922 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { |
922 TranslateInfoBarDelegate* delegate = | 923 TranslateInfoBarDelegate* delegate = |
923 infobar_helper->GetInfoBarDelegateAt(i)-> | 924 infobar_helper->GetInfoBarDelegateAt(i)-> |
924 AsTranslateInfoBarDelegate(); | 925 AsTranslateInfoBarDelegate(); |
925 if (delegate) | 926 if (delegate) |
926 return delegate; | 927 return delegate; |
927 } | 928 } |
928 return NULL; | 929 return NULL; |
929 } | 930 } |
OLD | NEW |