| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_profile_impl.h" | 5 #include "chrome/browser/automation/automation_profile_impl.h" |
| 6 #include "chrome/browser/chrome_thread.h" | 6 #include "chrome/browser/chrome_thread.h" |
| 7 #include "chrome/browser/net/chrome_url_request_context.h" | 7 #include "chrome/browser/net/chrome_url_request_context.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "net/url_request/url_request_context.h" | 9 #include "net/url_request/url_request_context.h" |
| 10 #include "chrome/test/automation/automation_messages.h" | 10 #include "chrome/test/automation/automation_messages.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return new AutomationURLRequestContext(original_context, | 151 return new AutomationURLRequestContext(original_context, |
| 152 automation_cookie_store); | 152 automation_cookie_store); |
| 153 } | 153 } |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_; | 156 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_; |
| 157 IPC::Message::Sender* automation_client_; | 157 IPC::Message::Sender* automation_client_; |
| 158 int tab_handle_; | 158 int tab_handle_; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // TODO(eroman): This duplicates CleanupRequestContext() from profile.cc. | |
| 162 void CleanupRequestContext(ChromeURLRequestContextGetter* context) { | |
| 163 context->CleanupOnUIThread(); | |
| 164 | |
| 165 // Clean up request context on IO thread. | |
| 166 ChromeThread::ReleaseSoon(ChromeThread::IO, FROM_HERE, context); | |
| 167 } | |
| 168 | |
| 169 ChromeURLRequestContextGetter* CreateAutomationURLRequestContextForTab( | 161 ChromeURLRequestContextGetter* CreateAutomationURLRequestContextForTab( |
| 170 int tab_handle, | 162 int tab_handle, |
| 171 Profile* profile, | 163 Profile* profile, |
| 172 IPC::Message::Sender* automation_client) { | 164 IPC::Message::Sender* automation_client) { |
| 173 ChromeURLRequestContextGetter* original_context = | 165 ChromeURLRequestContextGetter* original_context = |
| 174 static_cast<ChromeURLRequestContextGetter*>( | 166 static_cast<ChromeURLRequestContextGetter*>( |
| 175 profile->GetRequestContext()); | 167 profile->GetRequestContext()); |
| 176 | 168 |
| 177 ChromeURLRequestContextGetter* request_context = | 169 ChromeURLRequestContextGetter* request_context = |
| 178 new ChromeURLRequestContextGetter( | 170 new ChromeURLRequestContextGetter( |
| 179 NULL, // Don't register an observer on PrefService. | 171 NULL, // Don't register an observer on PrefService. |
| 180 new Factory(original_context, profile, automation_client, | 172 new Factory(original_context, profile, automation_client, |
| 181 tab_handle)); | 173 tab_handle)); |
| 182 return request_context; | 174 return request_context; |
| 183 } | 175 } |
| 184 | 176 |
| 185 } // namespace AutomationRequestContext | 177 } // namespace AutomationRequestContext |
| 186 | 178 |
| OLD | NEW |