| 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) { | |
| 584 FilePath user_data_dir; | |
| 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 } | |
| 592 DCHECK(context_getter); | 583 DCHECK(context_getter); |
| 593 | 584 |
| 594 BrowserThread::PostTask( | 585 BrowserThread::PostTask( |
| 595 BrowserThread::IO, FROM_HERE, | 586 BrowserThread::IO, FROM_HERE, |
| 596 new SetProxyConfigTask(context_getter, new_proxy_config)); | 587 new SetProxyConfigTask(context_getter, new_proxy_config)); |
| 597 } | 588 } |
| 598 | 589 |
| 599 TabContents* AutomationProvider::GetTabContentsForHandle( | 590 TabContents* AutomationProvider::GetTabContentsForHandle( |
| 600 int handle, NavigationController** tab) { | 591 int handle, NavigationController** tab) { |
| 601 if (tab_tracker_->ContainsHandle(handle)) { | 592 if (tab_tracker_->ContainsHandle(handle)) { |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 | 963 |
| 973 void AutomationProvider::SaveAsAsync(int tab_handle) { | 964 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 974 NavigationController* tab = NULL; | 965 NavigationController* tab = NULL; |
| 975 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 966 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
| 976 if (tab_contents) { | 967 if (tab_contents) { |
| 977 TabContentsWrapper* wrapper = | 968 TabContentsWrapper* wrapper = |
| 978 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 969 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 979 wrapper->download_tab_helper()->OnSavePage(); | 970 wrapper->download_tab_helper()->OnSavePage(); |
| 980 } | 971 } |
| 981 } | 972 } |
| OLD | NEW |