| 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_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/character_encoding.h" | 10 #include "chrome/browser/character_encoding.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 extension->location() == Extension::COMPONENT)) { | 105 extension->location() == Extension::COMPONENT)) { |
| 106 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); | 106 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); |
| 107 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); | 107 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 } | 111 } |
| 112 | 112 |
| 113 namespace chrome { | 113 namespace chrome { |
| 114 | 114 |
| 115 ChromeContentBrowserClient::ChromeContentBrowserClient() { |
| 116 // We treat about:kill, about:hang, and about:shorthang as the same site as |
| 117 // any URL since they are actually modifiers on existing pages. |
| 118 schemes_same_as_any_site_instance_.insert(chrome::kAboutKillURL); |
| 119 schemes_same_as_any_site_instance_.insert(chrome::kAboutHangURL); |
| 120 schemes_same_as_any_site_instance_.insert(chrome::kAboutShorthangURL); |
| 121 } |
| 122 |
| 123 ChromeContentBrowserClient::~ChromeContentBrowserClient() { |
| 124 } |
| 125 |
| 115 void ChromeContentBrowserClient::RenderViewHostCreated( | 126 void ChromeContentBrowserClient::RenderViewHostCreated( |
| 116 RenderViewHost* render_view_host) { | 127 RenderViewHost* render_view_host) { |
| 117 new ChromeRenderViewHostObserver(render_view_host); | 128 new ChromeRenderViewHostObserver(render_view_host); |
| 118 new DesktopNotificationHandler(render_view_host); | 129 new DesktopNotificationHandler(render_view_host); |
| 119 new DevToolsHandler(render_view_host); | 130 new DevToolsHandler(render_view_host); |
| 120 new ExtensionMessageHandler(render_view_host); | 131 new ExtensionMessageHandler(render_view_host); |
| 121 | 132 |
| 122 InitRenderViewHostForExtensions(render_view_host); | 133 InitRenderViewHostForExtensions(render_view_host); |
| 123 } | 134 } |
| 124 | 135 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 const Extension* extension = | 174 const Extension* extension = |
| 164 profile->GetExtensionService()->GetExtensionByWebExtent(url); | 175 profile->GetExtensionService()->GetExtensionByWebExtent(url); |
| 165 if (!extension) | 176 if (!extension) |
| 166 return url; | 177 return url; |
| 167 | 178 |
| 168 // If the URL is part of an extension's web extent, convert it to an | 179 // If the URL is part of an extension's web extent, convert it to an |
| 169 // extension URL. | 180 // extension URL. |
| 170 return extension->GetResourceURL(url.path()); | 181 return extension->GetResourceURL(url.path()); |
| 171 } | 182 } |
| 172 | 183 |
| 184 const std::set<std::string>* |
| 185 ChromeContentBrowserClient::GetSchemesSameAsAnySiteInstance() { |
| 186 return &schemes_same_as_any_site_instance_; |
| 187 } |
| 188 |
| 173 GURL ChromeContentBrowserClient::GetAlternateErrorPageURL( | 189 GURL ChromeContentBrowserClient::GetAlternateErrorPageURL( |
| 174 const TabContents* tab) { | 190 const TabContents* tab) { |
| 175 GURL url; | 191 GURL url; |
| 176 // Disable alternate error pages when in OffTheRecord/Incognito mode. | 192 // Disable alternate error pages when in OffTheRecord/Incognito mode. |
| 177 if (tab->profile()->IsOffTheRecord()) | 193 if (tab->profile()->IsOffTheRecord()) |
| 178 return url; | 194 return url; |
| 179 | 195 |
| 180 PrefService* prefs = tab->profile()->GetPrefs(); | 196 PrefService* prefs = tab->profile()->GetPrefs(); |
| 181 DCHECK(prefs); | 197 DCHECK(prefs); |
| 182 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { | 198 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 364 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 349 | 365 |
| 350 if (process_type == switches::kGpuProcess) | 366 if (process_type == switches::kGpuProcess) |
| 351 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); | 367 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); |
| 352 | 368 |
| 353 return -1; | 369 return -1; |
| 354 } | 370 } |
| 355 #endif | 371 #endif |
| 356 | 372 |
| 357 } // namespace chrome | 373 } // namespace chrome |
| OLD | NEW |