| 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 "content/test/test_content_browser_client.h" | 5 #include "content/test/test_content_browser_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/test/test_web_contents_view.h" | 12 #include "content/test/test_web_contents_view.h" |
| 13 #include "net/url_request/url_request_test_util.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 TestContentBrowserClient::TestContentBrowserClient() { | 17 TestContentBrowserClient::TestContentBrowserClient() { |
| 16 } | 18 } |
| 17 | 19 |
| 18 TestContentBrowserClient::~TestContentBrowserClient() { | 20 TestContentBrowserClient::~TestContentBrowserClient() { |
| 19 } | 21 } |
| 20 | 22 |
| 21 WebContentsViewPort* TestContentBrowserClient::OverrideCreateWebContentsView( | 23 WebContentsViewPort* TestContentBrowserClient::OverrideCreateWebContentsView( |
| 22 WebContents* web_contents, | 24 WebContents* web_contents, |
| 23 RenderViewHostDelegateView** render_view_host_delegate_view) { | 25 RenderViewHostDelegateView** render_view_host_delegate_view) { |
| 24 #if defined(OS_IOS) | 26 #if defined(OS_IOS) |
| 25 return NULL; | 27 return NULL; |
| 26 #else | 28 #else |
| 27 TestWebContentsView* rv = new TestWebContentsView; | 29 TestWebContentsView* rv = new TestWebContentsView; |
| 28 *render_view_host_delegate_view = rv; | 30 *render_view_host_delegate_view = rv; |
| 29 return rv; | 31 return rv; |
| 30 #endif | 32 #endif |
| 31 } | 33 } |
| 32 | 34 |
| 35 net::URLRequestContextGetter* TestContentBrowserClient::CreateRequestContext( |
| 36 BrowserContext* browser_context, |
| 37 ProtocolHandlerMap* protocol_handlers) { |
| 38 return new net::TestURLRequestContextGetter( |
| 39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 40 } |
| 41 |
| 33 base::FilePath TestContentBrowserClient::GetDefaultDownloadDirectory() { | 42 base::FilePath TestContentBrowserClient::GetDefaultDownloadDirectory() { |
| 34 if (!download_dir_.IsValid()) { | 43 if (!download_dir_.IsValid()) { |
| 35 bool result = download_dir_.CreateUniqueTempDir(); | 44 bool result = download_dir_.CreateUniqueTempDir(); |
| 36 CHECK(result); | 45 CHECK(result); |
| 37 } | 46 } |
| 38 return download_dir_.path(); | 47 return download_dir_.path(); |
| 39 } | 48 } |
| 40 | 49 |
| 41 } // namespace content | 50 } // namespace content |
| OLD | NEW |