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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, | 450 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, |
451 const GURL& url, | 451 const GURL& url, |
452 bool is_content_initiated, | 452 bool is_content_initiated, |
453 bool* send_referrer) { | 453 bool* send_referrer) { |
454 // If the navigation would cross an app extent boundary, we also need | 454 // If the navigation would cross an app extent boundary, we also need |
455 // to defer to the browser to ensure process isolation. | 455 // to defer to the browser to ensure process isolation. |
456 // TODO(erikkay) This is happening inside of a check to is_content_initiated | 456 // TODO(erikkay) This is happening inside of a check to is_content_initiated |
457 // which means that things like the back button won't trigger it. Is that | 457 // which means that things like the back button won't trigger it. Is that |
458 // OK? | 458 // OK? |
459 // TODO(creis): For hosted apps, we currently only swap processes to enter | |
460 // the app and not exit it, since we currently lose context (e.g., | |
461 // window.opener) if the window navigates back. See crbug.com/65953. | |
462 if (!CrossesExtensionExtents(frame, url)) | 459 if (!CrossesExtensionExtents(frame, url)) |
463 return false; | 460 return false; |
464 | 461 |
465 // Include the referrer in this case since we're going from a hosted web | 462 // Include the referrer in this case since we're going from a hosted web |
466 // page. (the packaged case is handled previously by the extension | 463 // page. (the packaged case is handled previously by the extension |
467 // navigation test) | 464 // navigation test) |
468 *send_referrer = true; | 465 *send_referrer = true; |
469 | 466 |
470 if (is_content_initiated) { | 467 if (is_content_initiated) { |
471 const Extension* extension = | 468 const Extension* extension = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 544 |
548 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame, | 545 bool ChromeContentRendererClient::CrossesExtensionExtents(WebFrame* frame, |
549 const GURL& new_url) { | 546 const GURL& new_url) { |
550 const ExtensionSet* extensions = extension_dispatcher_->extensions(); | 547 const ExtensionSet* extensions = extension_dispatcher_->extensions(); |
551 // If the URL is still empty, this is a window.open navigation. Check the | 548 // If the URL is still empty, this is a window.open navigation. Check the |
552 // opener's URL. | 549 // opener's URL. |
553 GURL old_url(frame->url()); | 550 GURL old_url(frame->url()); |
554 if (old_url.is_empty() && frame->opener()) | 551 if (old_url.is_empty() && frame->opener()) |
555 old_url = frame->opener()->url(); | 552 old_url = frame->opener()->url(); |
556 | 553 |
557 bool old_url_is_hosted_app = extensions->GetByURL(old_url) && | 554 return !extensions->InSameExtent(old_url, new_url); |
558 !extensions->GetByURL(old_url)->web_extent().is_empty(); | |
559 return !extensions->InSameExtent(old_url, new_url) && | |
560 !old_url_is_hosted_app; | |
561 } | 555 } |
562 | 556 |
563 } // namespace chrome | 557 } // namespace chrome |
OLD | NEW |