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