Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 8585016: Don't use process isolation for bookmark apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 bool ChromeContentRendererClient::IsProtocolSupportedForMedia( 722 bool ChromeContentRendererClient::IsProtocolSupportedForMedia(
723 const GURL& url) { 723 const GURL& url) {
724 return url.SchemeIs(chrome::kExtensionScheme); 724 return url.SchemeIs(chrome::kExtensionScheme);
725 } 725 }
726 726
727 void ChromeContentRendererClient::SetExtensionDispatcher( 727 void ChromeContentRendererClient::SetExtensionDispatcher(
728 ExtensionDispatcher* extension_dispatcher) { 728 ExtensionDispatcher* extension_dispatcher) {
729 extension_dispatcher_.reset(extension_dispatcher); 729 extension_dispatcher_.reset(extension_dispatcher);
730 } 730 }
731 731
732 const Extension* ChromeContentRendererClient::GetNonBookmarkAppExtension(
733 const ExtensionSet* extensions, const GURL& url) {
734 // Exclude bookmark apps, which do not use the app process model.
735 const Extension* extension = extensions->GetByURL(url);
736 if (extension && extension->from_bookmark())
737 extension = NULL;
738 return extension;
739 }
740
732 bool ChromeContentRendererClient::CrossesExtensionExtents( 741 bool ChromeContentRendererClient::CrossesExtensionExtents(
733 WebFrame* frame, 742 WebFrame* frame,
734 const GURL& new_url, 743 const GURL& new_url,
735 bool is_initial_navigation) { 744 bool is_initial_navigation) {
736 const ExtensionSet* extensions = extension_dispatcher_->extensions(); 745 const ExtensionSet* extensions = extension_dispatcher_->extensions();
737 bool is_extension_url = !!extensions->GetByURL(new_url);
738 GURL old_url(frame->top()->document().url()); 746 GURL old_url(frame->top()->document().url());
739 747
748 // Determine if the new URL is an extension (excluding bookmark apps).
749 const Extension* new_url_extension = GetNonBookmarkAppExtension(extensions,
750 new_url);
751
740 // If old_url is still empty and this is an initial navigation, then this is 752 // If old_url is still empty and this is an initial navigation, then this is
741 // a window.open operation. We should look at the opener URL. 753 // a window.open operation. We should look at the opener URL.
742 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { 754 if (is_initial_navigation && old_url.is_empty() && frame->opener()) {
743 // If we're about to open a normal web page from a same-origin opener stuck 755 // If we're about to open a normal web page from a same-origin opener stuck
744 // in an extension process, we want to keep it in process to allow the 756 // in an extension process, we want to keep it in process to allow the
745 // opener to script it. 757 // opener to script it.
746 GURL opener_url = frame->opener()->document().url(); 758 GURL opener_url = frame->opener()->document().url();
747 bool opener_is_extension_url = !!extensions->GetByURL(opener_url); 759 bool opener_is_extension_url = !!extensions->GetByURL(opener_url);
748 WebSecurityOrigin opener = frame->opener()->document().securityOrigin(); 760 WebSecurityOrigin opener = frame->opener()->document().securityOrigin();
749 if (!is_extension_url && 761 if (!new_url_extension &&
750 !opener_is_extension_url && 762 !opener_is_extension_url &&
751 extension_dispatcher_->is_extension_process() && 763 extension_dispatcher_->is_extension_process() &&
752 opener.canRequest(WebURL(new_url))) 764 opener.canRequest(WebURL(new_url)))
753 return false; 765 return false;
754 766
755 // In all other cases, we want to compare against the top frame's URL (as 767 // In all other cases, we want to compare against the top frame's URL (as
756 // opposed to the opener frame's), since that's what determines the type of 768 // opposed to the opener frame's), since that's what determines the type of
757 // process. This allows iframes outside an app to open a popup in the app. 769 // process. This allows iframes outside an app to open a popup in the app.
758 old_url = frame->top()->opener()->top()->document().url(); 770 old_url = frame->top()->opener()->top()->document().url();
759 } 771 }
760 772
773 // Determine if the old URL is an extension (excluding bookmark apps).
774 const Extension* old_url_extension = GetNonBookmarkAppExtension(extensions,
775 old_url);
776
761 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if 777 // TODO(creis): Temporary workaround for crbug.com/59285: Only return true if
762 // we would enter an extension app's extent from a non-app, or if we leave an 778 // we would enter an extension app's extent from a non-app, or if we leave an
763 // extension with no web extent. We avoid swapping processes to exit a hosted 779 // extension with no web extent. We avoid swapping processes to exit a hosted
764 // app for now, since we do not yet support postMessage calls from outside the 780 // app for now, since we do not yet support postMessage calls from outside the
765 // app back into it (e.g., as in Facebook OAuth 2.0). 781 // app back into it (e.g., as in Facebook OAuth 2.0).
766 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && 782 bool old_url_is_hosted_app = old_url_extension &&
767 !extensions->GetByURL(old_url)->web_extent().is_empty(); 783 !old_url_extension->web_extent().is_empty();
768 return !extensions->InSameExtent(old_url, new_url) && 784 if (old_url_is_hosted_app)
769 !old_url_is_hosted_app; 785 return false;
786
787 return old_url_extension != new_url_extension;
770 } 788 }
771 789
772 void ChromeContentRendererClient::OnPurgeMemory() { 790 void ChromeContentRendererClient::OnPurgeMemory() {
773 DVLOG(1) << "Resetting spellcheck in renderer client"; 791 DVLOG(1) << "Resetting spellcheck in renderer client";
774 RenderThread* thread = RenderThread::Get(); 792 RenderThread* thread = RenderThread::Get();
775 if (spellcheck_.get()) 793 if (spellcheck_.get())
776 thread->RemoveObserver(spellcheck_.get()); 794 thread->RemoveObserver(spellcheck_.get());
777 SpellCheck* new_spellcheck = new SpellCheck(); 795 SpellCheck* new_spellcheck = new SpellCheck();
778 if (spellcheck_provider_) 796 if (spellcheck_provider_)
779 spellcheck_provider_->SetSpellCheck(new_spellcheck); 797 spellcheck_provider_->SetSpellCheck(new_spellcheck);
(...skipping 22 matching lines...) Expand all
802 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { 820 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() {
803 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); 821 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled();
804 } 822 }
805 823
806 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( 824 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories(
807 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { 825 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) {
808 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); 826 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory);
809 } 827 }
810 828
811 } // namespace chrome 829 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698