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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, | 566 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, |
567 const GURL& url, | 567 const GURL& url, |
568 bool is_content_initiated, | 568 bool is_content_initiated, |
569 bool is_initial_navigation, | 569 bool is_initial_navigation, |
570 bool* send_referrer) { | 570 bool* send_referrer) { |
571 // If the navigation would cross an app extent boundary, we also need | 571 // If the navigation would cross an app extent boundary, we also need |
572 // to defer to the browser to ensure process isolation. | 572 // to defer to the browser to ensure process isolation. |
573 // TODO(erikkay) This is happening inside of a check to is_content_initiated | 573 // TODO(erikkay) This is happening inside of a check to is_content_initiated |
574 // which means that things like the back button won't trigger it. Is that | 574 // which means that things like the back button won't trigger it. Is that |
575 // OK? | 575 // OK? |
576 if (!CrossesExtensionExtents(frame, url, is_initial_navigation)) | 576 if (CrossesExtensionExtents(frame, url, is_initial_navigation)) { |
577 return false; | 577 // Include the referrer in this case since we're going from a hosted web |
| 578 // page. (the packaged case is handled previously by the extension |
| 579 // navigation test) |
| 580 *send_referrer = true; |
578 | 581 |
579 // Include the referrer in this case since we're going from a hosted web | 582 if (is_content_initiated) { |
580 // page. (the packaged case is handled previously by the extension | 583 const Extension* extension = |
581 // navigation test) | 584 extension_dispatcher_->extensions()->GetByURL(ExtensionURLInfo(url)); |
582 *send_referrer = true; | 585 if (extension && extension->is_app()) { |
583 | 586 UMA_HISTOGRAM_ENUMERATION( |
584 if (is_content_initiated) { | 587 extension_misc::kAppLaunchHistogram, |
585 const Extension* extension = | 588 extension_misc::APP_LAUNCH_CONTENT_NAVIGATION, |
586 extension_dispatcher_->extensions()->GetByURL(ExtensionURLInfo(url)); | 589 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
587 if (extension && extension->is_app()) { | 590 } |
588 UMA_HISTOGRAM_ENUMERATION( | |
589 extension_misc::kAppLaunchHistogram, | |
590 extension_misc::APP_LAUNCH_CONTENT_NAVIGATION, | |
591 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | |
592 } | 591 } |
| 592 return true; |
593 } | 593 } |
594 | 594 |
595 return true; | 595 // Navigating to a new chrome:// scheme (in a new tab) from within a |
| 596 // chrome:// page must be a browser navigation so that the browser can |
| 597 // register the new associated data source. |
| 598 if (is_content_initiated && url.SchemeIs(kChromeUIScheme)) |
| 599 return true; |
| 600 |
| 601 return false; |
596 } | 602 } |
597 | 603 |
598 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, | 604 bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, |
599 const GURL& url, | 605 const GURL& url, |
600 GURL* new_url) { | 606 GURL* new_url) { |
601 // If the request is for an extension resource, check whether it should be | 607 // If the request is for an extension resource, check whether it should be |
602 // allowed. If not allowed, we reset the URL to something invalid to prevent | 608 // allowed. If not allowed, we reset the URL to something invalid to prevent |
603 // the request and cause an error. | 609 // the request and cause an error. |
604 if (url.SchemeIs(chrome::kExtensionScheme) && | 610 if (url.SchemeIs(chrome::kExtensionScheme) && |
605 !ExtensionResourceRequestPolicy::CanRequestResource( | 611 !ExtensionResourceRequestPolicy::CanRequestResource( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 789 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
784 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 790 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
785 } | 791 } |
786 | 792 |
787 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 793 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
788 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 794 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
789 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 795 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
790 } | 796 } |
791 | 797 |
792 } // namespace chrome | 798 } // namespace chrome |
OLD | NEW |