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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 440 |
441 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, | 441 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, |
442 const GURL& url, | 442 const GURL& url, |
443 bool is_content_initiated, | 443 bool is_content_initiated, |
444 bool* send_referrer) { | 444 bool* send_referrer) { |
445 // If the navigation would cross an app extent boundary, we also need | 445 // If the navigation would cross an app extent boundary, we also need |
446 // to defer to the browser to ensure process isolation. | 446 // to defer to the browser to ensure process isolation. |
447 // TODO(erikkay) This is happening inside of a check to is_content_initiated | 447 // TODO(erikkay) This is happening inside of a check to is_content_initiated |
448 // which means that things like the back button won't trigger it. Is that | 448 // which means that things like the back button won't trigger it. Is that |
449 // OK? | 449 // OK? |
450 // TODO(creis): For hosted apps, we currently only swap processes to enter | |
451 // the app and not exit it, since we currently lose context (e.g., | |
452 // window.opener) if the window navigates back. See crbug.com/65953. | |
453 if (!CrossesExtensionExtents(frame, url)) | 450 if (!CrossesExtensionExtents(frame, url)) |
454 return false; | 451 return false; |
455 | 452 |
456 // Include the referrer in this case since we're going from a hosted web | 453 // Include the referrer in this case since we're going from a hosted web |
457 // page. (the packaged case is handled previously by the extension | 454 // page. (the packaged case is handled previously by the extension |
458 // navigation test) | 455 // navigation test) |
459 *send_referrer = true; | 456 *send_referrer = true; |
460 | 457 |
461 if (is_content_initiated) { | 458 if (is_content_initiated) { |
462 const Extension* extension = | 459 const Extension* extension = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 535 |
539 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame, | 536 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame, |
540 const GURL& new_url) { | 537 const GURL& new_url) { |
541 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 538 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
542 // If the URL is still empty, this is a window.open navigation. Check the | 539 // If the URL is still empty, this is a window.open navigation. Check the |
543 // opener's URL. | 540 // opener's URL. |
544 GURL old_url(frame->url()); | 541 GURL old_url(frame->url()); |
545 if (old_url.is_empty() && frame->opener()) | 542 if (old_url.is_empty() && frame->opener()) |
546 old_url = frame->opener()->url(); | 543 old_url = frame->opener()->url(); |
547 | 544 |
548 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && | 545 return !extensions->InSameExtent(old_url, new_url); |
549 !extensions->GetByURL(old_url)->web_extent().is_empty(); | |
550 return !extensions->InSameExtent(old_url, new_url) && | |
551 !old_url_is_hosted_app; | |
552 } | 546 } |
553 | 547 |
554 } // namespace chrome | 548 } // namespace chrome |
OLD | NEW |