Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/renderer/render_view.cc

Issue 19624: Add early-injection capability to user scripts. I haven't yet (Closed)
Patch Set: Use new documentElementAvailable() callback Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 void RenderView::DidFailLoadWithError(WebView* webview, 1452 void RenderView::DidFailLoadWithError(WebView* webview,
1453 const WebError& error, 1453 const WebError& error,
1454 WebFrame* frame) { 1454 WebFrame* frame) {
1455 } 1455 }
1456 1456
1457 void RenderView::DidFinishDocumentLoadForFrame(WebView* webview, 1457 void RenderView::DidFinishDocumentLoadForFrame(WebView* webview,
1458 WebFrame* frame) { 1458 WebFrame* frame) {
1459 // Check whether we have new encoding name. 1459 // Check whether we have new encoding name.
1460 UpdateEncoding(frame, webview->GetMainFrameEncodingName()); 1460 UpdateEncoding(frame, webview->GetMainFrameEncodingName());
1461 1461
1462 // Inject any user scripts. Do not inject into chrome UI pages, but do inject 1462 if (g_render_thread) // Will be NULL when testing.
1463 // into any other document. 1463 g_render_thread->user_script_slave()->InjectScripts(
1464 const GURL &gurl = frame->GetURL(); 1464 frame, UserScript::DOCUMENT_END);
1465 if (g_render_thread && // Will be NULL when testing.
1466 (gurl.SchemeIs("file") ||
1467 gurl.SchemeIs("http") ||
1468 gurl.SchemeIs("https"))) {
1469 g_render_thread->user_script_slave()->InjectScripts(frame);
1470 }
1471 } 1465 }
1472 1466
1473 void RenderView::DidHandleOnloadEventsForFrame(WebView* webview, 1467 void RenderView::DidHandleOnloadEventsForFrame(WebView* webview,
1474 WebFrame* frame) { 1468 WebFrame* frame) {
1475 } 1469 }
1476 1470
1477 void RenderView::DidChangeLocationWithinPageForFrame(WebView* webview, 1471 void RenderView::DidChangeLocationWithinPageForFrame(WebView* webview,
1478 WebFrame* frame, 1472 WebFrame* frame,
1479 bool is_new_navigation) { 1473 bool is_new_navigation) {
1480 DidCommitLoadForFrame(webview, frame, is_new_navigation); 1474 DidCommitLoadForFrame(webview, frame, is_new_navigation);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 external_host_bindings_.set_routing_id(routing_id_); 1522 external_host_bindings_.set_routing_id(routing_id_);
1529 external_host_bindings_.BindToJavascript(webframe, L"externalHost"); 1523 external_host_bindings_.BindToJavascript(webframe, L"externalHost");
1530 } 1524 }
1531 1525
1532 #ifdef CHROME_PERSONALIZATION 1526 #ifdef CHROME_PERSONALIZATION
1533 Personalization::ConfigureRendererPersonalization(personalization_, this, 1527 Personalization::ConfigureRendererPersonalization(personalization_, this,
1534 routing_id_, webframe); 1528 routing_id_, webframe);
1535 #endif 1529 #endif
1536 } 1530 }
1537 1531
1532 void RenderView::DocumentElementAvailable(WebFrame* frame) {
1533 if (g_render_thread) // Will be NULL when testing.
1534 g_render_thread->user_script_slave()->InjectScripts(
1535 frame, UserScript::DOCUMENT_START);
1536 }
1537
1538 WindowOpenDisposition RenderView::DispositionForNavigationAction( 1538 WindowOpenDisposition RenderView::DispositionForNavigationAction(
1539 WebView* webview, 1539 WebView* webview,
1540 WebFrame* frame, 1540 WebFrame* frame,
1541 const WebRequest* request, 1541 const WebRequest* request,
1542 WebNavigationType type, 1542 WebNavigationType type,
1543 WindowOpenDisposition disposition, 1543 WindowOpenDisposition disposition,
1544 bool is_redirect) { 1544 bool is_redirect) {
1545 // Webkit is asking whether to navigate to a new URL. 1545 // Webkit is asking whether to navigate to a new URL.
1546 // This is fine normally, except if we're showing UI from one security 1546 // This is fine normally, except if we're showing UI from one security
1547 // context and they're trying to navigate to a different context. 1547 // context and they're trying to navigate to a different context.
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 #if defined(OS_WIN) 2863 #if defined(OS_WIN)
2864 // "t" is the id of the templates root node. 2864 // "t" is the id of the templates root node.
2865 return jstemplate_builder::GetTemplateHtml( 2865 return jstemplate_builder::GetTemplateHtml(
2866 template_html, &error_strings, "t"); 2866 template_html, &error_strings, "t");
2867 #else 2867 #else
2868 // TODO(port) 2868 // TODO(port)
2869 NOTIMPLEMENTED(); 2869 NOTIMPLEMENTED();
2870 return std::string(); 2870 return std::string();
2871 #endif // OS_WIN 2871 #endif // OS_WIN
2872 } 2872 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698