Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 } | 572 } |
| 573 | 573 |
| 574 private: | 574 private: |
| 575 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 575 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 576 std::string proxy_config_; | 576 std::string proxy_config_; |
| 577 }; | 577 }; |
| 578 | 578 |
| 579 | 579 |
| 580 void AutomationProvider::SetProxyConfig(const std::string& new_proxy_config) { | 580 void AutomationProvider::SetProxyConfig(const std::string& new_proxy_config) { |
| 581 net::URLRequestContextGetter* context_getter = | 581 net::URLRequestContextGetter* context_getter = |
| 582 Profile::GetDefaultRequestContext(); | 582 profile_->GetRequestContext(); |
| 583 if (!context_getter) { | 583 if (!context_getter) { |
| 584 FilePath user_data_dir; | 584 context_getter = g_browser_process->system_request_context(); |
|
willchan no longer on Chromium
2011/06/08 16:55:35
Profile always lazily creates a URLRequestContextG
| |
| 585 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | |
| 586 ProfileManager* profile_manager = g_browser_process->profile_manager(); | |
| 587 DCHECK(profile_manager); | |
| 588 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | |
| 589 DCHECK(profile); | |
| 590 context_getter = profile->GetRequestContext(); | |
| 591 } | 585 } |
| 592 DCHECK(context_getter); | 586 DCHECK(context_getter); |
| 593 | 587 |
| 594 BrowserThread::PostTask( | 588 BrowserThread::PostTask( |
| 595 BrowserThread::IO, FROM_HERE, | 589 BrowserThread::IO, FROM_HERE, |
| 596 new SetProxyConfigTask(context_getter, new_proxy_config)); | 590 new SetProxyConfigTask(context_getter, new_proxy_config)); |
| 597 } | 591 } |
| 598 | 592 |
| 599 TabContents* AutomationProvider::GetTabContentsForHandle( | 593 TabContents* AutomationProvider::GetTabContentsForHandle( |
| 600 int handle, NavigationController** tab) { | 594 int handle, NavigationController** tab) { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 | 966 |
| 973 void AutomationProvider::SaveAsAsync(int tab_handle) { | 967 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 974 NavigationController* tab = NULL; | 968 NavigationController* tab = NULL; |
| 975 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 969 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
| 976 if (tab_contents) { | 970 if (tab_contents) { |
| 977 TabContentsWrapper* wrapper = | 971 TabContentsWrapper* wrapper = |
| 978 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 972 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 979 wrapper->download_tab_helper()->OnSavePage(); | 973 wrapper->download_tab_helper()->OnSavePage(); |
| 980 } | 974 } |
| 981 } | 975 } |
| OLD | NEW |