| 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/app/breakpad_mac.h" | 8 #include "chrome/app/breakpad_mac.h" |
| 9 #include "chrome/browser/browser_about_handler.h" | 9 #include "chrome/browser/browser_about_handler.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/browser/browsing_instance.h" | 54 #include "content/browser/browsing_instance.h" |
| 55 #include "content/browser/debugger/devtools_handler.h" | 55 #include "content/browser/debugger/devtools_handler.h" |
| 56 #include "content/browser/plugin_process_host.h" | 56 #include "content/browser/plugin_process_host.h" |
| 57 #include "content/browser/renderer_host/browser_render_process_host.h" | 57 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 58 #include "content/browser/renderer_host/render_view_host.h" | 58 #include "content/browser/renderer_host/render_view_host.h" |
| 59 #include "content/browser/resource_context.h" | 59 #include "content/browser/resource_context.h" |
| 60 #include "content/browser/site_instance.h" | 60 #include "content/browser/site_instance.h" |
| 61 #include "content/browser/ssl/ssl_cert_error_handler.h" | 61 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| 62 #include "content/browser/ssl/ssl_client_auth_handler.h" | 62 #include "content/browser/ssl/ssl_client_auth_handler.h" |
| 63 #include "content/browser/tab_contents/tab_contents.h" | 63 #include "content/browser/tab_contents/tab_contents.h" |
| 64 #include "content/browser/tab_contents/tab_contents_view.h" |
| 64 #include "content/browser/worker_host/worker_process_host.h" | 65 #include "content/browser/worker_host/worker_process_host.h" |
| 65 #include "content/common/desktop_notification_messages.h" | 66 #include "content/common/desktop_notification_messages.h" |
| 66 #include "grit/ui_resources.h" | 67 #include "grit/ui_resources.h" |
| 67 #include "net/base/cookie_monster.h" | 68 #include "net/base/cookie_monster.h" |
| 68 #include "net/base/cookie_options.h" | 69 #include "net/base/cookie_options.h" |
| 69 #include "ui/base/resource/resource_bundle.h" | 70 #include "ui/base/resource/resource_bundle.h" |
| 70 | 71 |
| 71 #if defined(OS_LINUX) | 72 #if defined(OS_LINUX) |
| 72 #include "base/linux_util.h" | 73 #include "base/linux_util.h" |
| 73 #include "chrome/browser/crash_handler_host_linux.h" | 74 #include "chrome/browser/crash_handler_host_linux.h" |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 77 #if defined(TOOLKIT_VIEWS) |
| 78 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 79 #elif defined(OS_LINUX) |
| 80 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 81 #elif defined(OS_MACOSX) |
| 82 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 83 #elif defined(TOUCH_UI) |
| 84 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
| 85 #endif |
| 86 |
| 76 #if defined(USE_NSS) | 87 #if defined(USE_NSS) |
| 77 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 88 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
| 78 #endif | 89 #endif |
| 79 | 90 |
| 80 namespace { | 91 namespace { |
| 81 | 92 |
| 82 // Handles rewriting Web UI URLs. | 93 // Handles rewriting Web UI URLs. |
| 83 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { | 94 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { |
| 84 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url)) | 95 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url)) |
| 85 return false; | 96 return false; |
| 86 | 97 |
| 87 // Special case the new tab page. In older versions of Chrome, the new tab | 98 // Special case the new tab page. In older versions of Chrome, the new tab |
| 88 // page was hosted at chrome-internal:<blah>. This might be in people's saved | 99 // page was hosted at chrome-internal:<blah>. This might be in people's saved |
| 89 // sessions or bookmarks, so we say any URL with that scheme triggers the new | 100 // sessions or bookmarks, so we say any URL with that scheme triggers the new |
| 90 // tab page. | 101 // tab page. |
| 91 if (url->SchemeIs(chrome::kChromeInternalScheme)) { | 102 if (url->SchemeIs(chrome::kChromeInternalScheme)) { |
| 92 // Rewrite it with the proper new tab URL. | 103 // Rewrite it with the proper new tab URL. |
| 93 *url = GURL(chrome::kChromeUINewTabURL); | 104 *url = GURL(chrome::kChromeUINewTabURL); |
| 94 } | 105 } |
| 95 | 106 |
| 96 return true; | 107 return true; |
| 97 } | 108 } |
| 98 | 109 |
| 99 } // namespace | 110 } // namespace |
| 100 | 111 |
| 101 namespace chrome { | 112 namespace chrome { |
| 102 | 113 |
| 114 TabContentsView* ChromeContentBrowserClient::CreateTabContentsView( |
| 115 TabContents* tab_contents) { |
| 116 #if defined(TOOLKIT_VIEWS) |
| 117 return new TabContentsViewViews(tab_contents); |
| 118 #elif defined(OS_LINUX) |
| 119 return new TabContentsViewGtk(tab_contents); |
| 120 #elif defined(OS_MACOSX) |
| 121 return tab_contents_view_mac::CreateTabContentsView(tab_contents); |
| 122 #elif defined(TOUCH_UI) |
| 123 return new TabContentsViewTouch(tab_contents); |
| 124 #else |
| 125 #error Need to create your platform TabContentsView here. |
| 126 #endif |
| 127 } |
| 128 |
| 103 void ChromeContentBrowserClient::RenderViewHostCreated( | 129 void ChromeContentBrowserClient::RenderViewHostCreated( |
| 104 RenderViewHost* render_view_host) { | 130 RenderViewHost* render_view_host) { |
| 105 new ChromeRenderViewHostObserver(render_view_host); | 131 new ChromeRenderViewHostObserver(render_view_host); |
| 106 new DevToolsHandler(render_view_host); | 132 new DevToolsHandler(render_view_host); |
| 107 new ExtensionMessageHandler(render_view_host); | 133 new ExtensionMessageHandler(render_view_host); |
| 108 } | 134 } |
| 109 | 135 |
| 110 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( | 136 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( |
| 111 BrowserRenderProcessHost* host) { | 137 BrowserRenderProcessHost* host) { |
| 112 int id = host->id(); | 138 int id = host->id(); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 #if defined(USE_NSS) | 761 #if defined(USE_NSS) |
| 736 crypto::CryptoModuleBlockingPasswordDelegate* | 762 crypto::CryptoModuleBlockingPasswordDelegate* |
| 737 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 763 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 738 const GURL& url) { | 764 const GURL& url) { |
| 739 return browser::NewCryptoModuleBlockingDialogDelegate( | 765 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 740 browser::kCryptoModulePasswordKeygen, url.host()); | 766 browser::kCryptoModulePasswordKeygen, url.host()); |
| 741 } | 767 } |
| 742 #endif | 768 #endif |
| 743 | 769 |
| 744 } // namespace chrome | 770 } // namespace chrome |
| OLD | NEW |