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