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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 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 | Annotate | Revision Log
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/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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (CommandLine::ForCurrentProcess()->HasSwitch( 807 if (CommandLine::ForCurrentProcess()->HasSwitch(
808 switches::kDisableTranslate) || 808 switches::kDisableTranslate) ||
809 (prefs != NULL && !prefs->GetBoolean(prefs::kEnableTranslate))) { 809 (prefs != NULL && !prefs->GetBoolean(prefs::kEnableTranslate))) {
810 return; 810 return;
811 } 811 }
812 812
813 std::string language_list_fetch_url = base::StringPrintf( 813 std::string language_list_fetch_url = base::StringPrintf(
814 kLanguageListFetchURL, 814 kLanguageListFetchURL,
815 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str()); 815 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str());
816 language_list_request_pending_.reset(content::URLFetcher::Create( 816 language_list_request_pending_.reset(content::URLFetcher::Create(
817 1, GURL(language_list_fetch_url), content::URLFetcher::GET, this)); 817 1, GURL(language_list_fetch_url), net::URLFetcher::GET, this));
818 language_list_request_pending_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 818 language_list_request_pending_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
819 net::LOAD_DO_NOT_SAVE_COOKIES); 819 net::LOAD_DO_NOT_SAVE_COOKIES);
820 language_list_request_pending_->SetRequestContext( 820 language_list_request_pending_->SetRequestContext(
821 g_browser_process->system_request_context()); 821 g_browser_process->system_request_context());
822 language_list_request_pending_->SetMaxRetries(kMaxRetryLanguageListFetch); 822 language_list_request_pending_->SetMaxRetries(kMaxRetryLanguageListFetch);
823 language_list_request_pending_->Start(); 823 language_list_request_pending_->Start();
824 } 824 }
825 825
826 void TranslateManager::CleanupPendingUlrFetcher() { 826 void TranslateManager::CleanupPendingUlrFetcher() {
827 language_list_request_pending_.reset(); 827 language_list_request_pending_.reset();
828 translate_script_request_pending_.reset(); 828 translate_script_request_pending_.reset();
829 } 829 }
830 830
831 void TranslateManager::RequestTranslateScript() { 831 void TranslateManager::RequestTranslateScript() {
832 if (translate_script_request_pending_.get() != NULL) 832 if (translate_script_request_pending_.get() != NULL)
833 return; 833 return;
834 834
835 std::string translate_script_url = base::StringPrintf( 835 std::string translate_script_url = base::StringPrintf(
836 kTranslateScriptURL, 836 kTranslateScriptURL,
837 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str()); 837 GetLanguageCode(g_browser_process->GetApplicationLocale()).c_str());
838 translate_script_request_pending_.reset(content::URLFetcher::Create( 838 translate_script_request_pending_.reset(content::URLFetcher::Create(
839 0, GURL(translate_script_url), content::URLFetcher::GET, this)); 839 0, GURL(translate_script_url), net::URLFetcher::GET, this));
840 translate_script_request_pending_->SetLoadFlags( 840 translate_script_request_pending_->SetLoadFlags(
841 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); 841 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
842 translate_script_request_pending_->SetRequestContext( 842 translate_script_request_pending_->SetRequestContext(
843 g_browser_process->system_request_context()); 843 g_browser_process->system_request_context());
844 translate_script_request_pending_->SetExtraRequestHeaders( 844 translate_script_request_pending_->SetExtraRequestHeaders(
845 kTranslateScriptHeader); 845 kTranslateScriptHeader);
846 translate_script_request_pending_->Start(); 846 translate_script_request_pending_->Start();
847 } 847 }
848 848
849 void TranslateManager::ShowInfoBar(content::WebContents* tab, 849 void TranslateManager::ShowInfoBar(content::WebContents* tab,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 899 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper();
900 900
901 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 901 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
902 TranslateInfoBarDelegate* delegate = 902 TranslateInfoBarDelegate* delegate =
903 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 903 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
904 if (delegate) 904 if (delegate)
905 return delegate; 905 return delegate;
906 } 906 }
907 return NULL; 907 return NULL;
908 } 908 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/browser/ui/intents/web_intent_picker_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698