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