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

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

Issue 7608015: When determining whether or not to swap processes on navigation, check the top frame's URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months 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
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/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 void ChromeContentRendererClient::SetExtensionDispatcher( 665 void ChromeContentRendererClient::SetExtensionDispatcher(
666 ExtensionDispatcher* extension_dispatcher) { 666 ExtensionDispatcher* extension_dispatcher) {
667 extension_dispatcher_.reset(extension_dispatcher); 667 extension_dispatcher_.reset(extension_dispatcher);
668 } 668 }
669 669
670 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame, 670 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame,
671 const GURL& new_url) { 671 const GURL& new_url) {
672 const ExtensionSet* extensions = extension_dispatcher_->extensions(); 672 const ExtensionSet* extensions = extension_dispatcher_->extensions();
673 // If the URL is still empty, this is a window.open navigation. Check the 673 // If the URL is still empty, this is a window.open navigation. Check the
674 // opener's URL. 674 // opener's URL. In all cases we use the top frame's URL (as opposed to our
675 // frame's) since that's what determines the type of process.
675 // TODO(abarth): This code is super sketchy! Are you sure looking at the 676 // TODO(abarth): This code is super sketchy! Are you sure looking at the
676 // opener is correct here? This appears to let me steal my opener's 677 // opener is correct here? This appears to let me steal my opener's
677 // privileges if I can make my URL be "empty." 678 // privileges if I can make my URL be "empty."
678 GURL old_url(frame->document().url()); 679 GURL old_url(frame->top()->document().url());
679 if (old_url.is_empty() && frame->opener()) 680 if (old_url.is_empty() && frame->opener())
680 old_url = frame->opener()->document().url(); 681 old_url = frame->top()->opener()->top()->document().url();
681 682
682 // If this is a reload, check whether it has the wrong process type. We 683 // If this is a reload, check whether it has the wrong process type. We
683 // should send it to the browser if it's an extension URL (e.g., hosted app) 684 // should send it to the browser if it's an extension URL (e.g., hosted app)
684 // in a normal process, or if it's a process for an extension that has been 685 // in a normal process, or if it's a process for an extension that has been
685 // uninstalled. 686 // uninstalled.
686 if (old_url == new_url) { 687 if (old_url == new_url) {
687 bool is_extension_url = !!extensions->GetByURL(new_url); 688 bool is_extension_url = !!extensions->GetByURL(new_url);
688 if (is_extension_url != extension_dispatcher_->is_extension_process()) 689 if (is_extension_url != extension_dispatcher_->is_extension_process())
689 return true; 690 return true;
690 } 691 }
691 692
692 return !extensions->InSameExtent(old_url, new_url); 693 return !extensions->InSameExtent(old_url, new_url);
693 } 694 }
694 695
695 void ChromeContentRendererClient::OnPurgeMemory() { 696 void ChromeContentRendererClient::OnPurgeMemory() {
696 DVLOG(1) << "Resetting spellcheck in renderer client"; 697 DVLOG(1) << "Resetting spellcheck in renderer client";
697 RenderThread* thread = RenderThread::current(); 698 RenderThread* thread = RenderThread::current();
698 if (spellcheck_.get()) 699 if (spellcheck_.get())
699 thread->RemoveObserver(spellcheck_.get()); 700 thread->RemoveObserver(spellcheck_.get());
700 SpellCheck* new_spellcheck = new SpellCheck(); 701 SpellCheck* new_spellcheck = new SpellCheck();
701 if (spellcheck_provider_) 702 if (spellcheck_provider_)
702 spellcheck_provider_->SetSpellCheck(new_spellcheck); 703 spellcheck_provider_->SetSpellCheck(new_spellcheck);
703 spellcheck_.reset(new_spellcheck); 704 spellcheck_.reset(new_spellcheck);
704 thread->AddObserver(new_spellcheck); 705 thread->AddObserver(new_spellcheck);
705 } 706 }
706 707
707 } // namespace chrome 708 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_process_apitest.cc ('k') | chrome/test/data/extensions/api_test/app_process/path1/iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698