OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 // treat such cases as browser navigations (in which we will create a new | 1719 // treat such cases as browser navigations (in which we will create a new |
1720 // renderer for a cross-site navigation), rather than WebKit navigations. | 1720 // renderer for a cross-site navigation), rather than WebKit navigations. |
1721 // | 1721 // |
1722 // We use the following heuristic to decide whether to fork a new page in its | 1722 // We use the following heuristic to decide whether to fork a new page in its |
1723 // own process: | 1723 // own process: |
1724 // The parent page must open a new tab to about:blank, set the new tab's | 1724 // The parent page must open a new tab to about:blank, set the new tab's |
1725 // window.opener to null, and then redirect the tab to a cross-site URL using | 1725 // window.opener to null, and then redirect the tab to a cross-site URL using |
1726 // JavaScript. | 1726 // JavaScript. |
1727 bool is_fork = | 1727 bool is_fork = |
1728 // Must start from a tab showing about:blank, which is later redirected. | 1728 // Must start from a tab showing about:blank, which is later redirected. |
1729 GURL(frame->url()) == GURL("about:blank") && | 1729 GURL(frame->url()) == GURL(chrome::kAboutBlankURL) && |
1730 // Must be the first real navigation of the tab. | 1730 // Must be the first real navigation of the tab. |
1731 GetHistoryBackListCount() < 1 && | 1731 GetHistoryBackListCount() < 1 && |
1732 GetHistoryForwardListCount() < 1 && | 1732 GetHistoryForwardListCount() < 1 && |
1733 // The parent page must have set the child's window.opener to null before | 1733 // The parent page must have set the child's window.opener to null before |
1734 // redirecting to the desired URL. | 1734 // redirecting to the desired URL. |
1735 frame->opener() == NULL && | 1735 frame->opener() == NULL && |
1736 // Must be a top-level frame. | 1736 // Must be a top-level frame. |
1737 frame->parent() == NULL && | 1737 frame->parent() == NULL && |
1738 // Must not have issued the request from this page. | 1738 // Must not have issued the request from this page. |
1739 is_content_initiated && | 1739 is_content_initiated && |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 } | 1998 } |
1999 | 1999 |
2000 void RenderView::didCreateDocumentElement(WebFrame* frame) { | 2000 void RenderView::didCreateDocumentElement(WebFrame* frame) { |
2001 if (RenderThread::current()) { // Will be NULL during unit tests. | 2001 if (RenderThread::current()) { // Will be NULL during unit tests. |
2002 RenderThread::current()->user_script_slave()->InjectScripts( | 2002 RenderThread::current()->user_script_slave()->InjectScripts( |
2003 frame, UserScript::DOCUMENT_START); | 2003 frame, UserScript::DOCUMENT_START); |
2004 } | 2004 } |
2005 | 2005 |
2006 // Notify the browser about non-blank documents loading in the top frame. | 2006 // Notify the browser about non-blank documents loading in the top frame. |
2007 GURL url = frame->url(); | 2007 GURL url = frame->url(); |
2008 if (url.is_valid() && url.spec() != "about:blank") { | 2008 if (url.is_valid() && url.spec() != chrome::kAboutBlankURL) { |
2009 if (frame == webview()->GetMainFrame()) | 2009 if (frame == webview()->GetMainFrame()) |
2010 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); | 2010 Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_)); |
2011 } | 2011 } |
2012 } | 2012 } |
2013 | 2013 |
2014 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { | 2014 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { |
2015 UpdateTitle(frame, title); | 2015 UpdateTitle(frame, title); |
2016 | 2016 |
2017 // Also check whether we have new encoding name. | 2017 // Also check whether we have new encoding name. |
2018 UpdateEncoding(frame, frame->view()->GetMainFrameEncodingName()); | 2018 UpdateEncoding(frame, frame->view()->GetMainFrameEncodingName()); |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3486 // TODO(darin): There's actually no reason for this to be here. We should | 3486 // TODO(darin): There's actually no reason for this to be here. We should |
3487 // have the browser side manage the document tag. | 3487 // have the browser side manage the document tag. |
3488 #if defined(OS_MACOSX) | 3488 #if defined(OS_MACOSX) |
3489 if (!has_document_tag_) { | 3489 if (!has_document_tag_) { |
3490 // Make the call to get the tag. | 3490 // Make the call to get the tag. |
3491 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); | 3491 Send(new ViewHostMsg_GetDocumentTag(routing_id_, &document_tag_)); |
3492 has_document_tag_ = true; | 3492 has_document_tag_ = true; |
3493 } | 3493 } |
3494 #endif | 3494 #endif |
3495 } | 3495 } |
OLD | NEW |