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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 159542: Add a WebKit API that registers a V8 extension to be loaded into content (Closed)
Patch Set: final Created 11 years, 4 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
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | webkit/tools/test_shell/layout_test_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 ExceptionCode err = 0; 1596 ExceptionCode err = 0;
1597 stylesheet->setTextContent(webkit_glue::StdStringToString(css), err); 1597 stylesheet->setTextContent(webkit_glue::StdStringToString(css), err);
1598 DCHECK(!err) << "Failed to set style element content"; 1598 DCHECK(!err) << "Failed to set style element content";
1599 WebCore::Node* first = document_element->firstChild(); 1599 WebCore::Node* first = document_element->firstChild();
1600 bool success = document_element->insertBefore(stylesheet, first, err); 1600 bool success = document_element->insertBefore(stylesheet, first, err);
1601 DCHECK(success) << "Failed to insert stylesheet"; 1601 DCHECK(success) << "Failed to insert stylesheet";
1602 return success; 1602 return success;
1603 } 1603 }
1604 1604
1605 void WebFrameImpl::ExecuteScriptInNewContext( 1605 void WebFrameImpl::ExecuteScriptInNewContext(
1606 const WebScriptSource* sources_in, int num_sources) { 1606 const WebScriptSource* sources_in, int num_sources,
1607 int extension_group) {
1607 Vector<WebCore::ScriptSourceCode> sources; 1608 Vector<WebCore::ScriptSourceCode> sources;
1608 1609
1609 for (int i = 0; i < num_sources; ++i) { 1610 for (int i = 0; i < num_sources; ++i) {
1610 sources.append(WebCore::ScriptSourceCode( 1611 sources.append(WebCore::ScriptSourceCode(
1611 webkit_glue::WebStringToString(sources_in[i].code), 1612 webkit_glue::WebStringToString(sources_in[i].code),
1612 webkit_glue::WebURLToKURL(sources_in[i].url), 1613 webkit_glue::WebURLToKURL(sources_in[i].url),
1613 sources_in[i].startLine)); 1614 sources_in[i].startLine));
1614 } 1615 }
1615 1616
1616 frame_->script()->evaluateInNewContext(sources); 1617 frame_->script()->evaluateInNewContext(sources, extension_group);
1617 } 1618 }
1618 1619
1619 void WebFrameImpl::ExecuteScriptInNewWorld( 1620 void WebFrameImpl::ExecuteScriptInNewWorld(
1620 const WebScriptSource* sources_in, int num_sources) { 1621 const WebScriptSource* sources_in, int num_sources,
1622 int extension_group) {
1621 Vector<WebCore::ScriptSourceCode> sources; 1623 Vector<WebCore::ScriptSourceCode> sources;
1622 1624
1623 for (int i = 0; i < num_sources; ++i) { 1625 for (int i = 0; i < num_sources; ++i) {
1624 sources.append(WebCore::ScriptSourceCode( 1626 sources.append(WebCore::ScriptSourceCode(
1625 webkit_glue::WebStringToString(sources_in[i].code), 1627 webkit_glue::WebStringToString(sources_in[i].code),
1626 webkit_glue::WebURLToKURL(sources_in[i].url), 1628 webkit_glue::WebURLToKURL(sources_in[i].url),
1627 sources_in[i].startLine)); 1629 sources_in[i].startLine));
1628 } 1630 }
1629 1631
1630 frame_->script()->evaluateInNewWorld(sources); 1632 frame_->script()->evaluateInNewWorld(sources, extension_group);
1631 } 1633 }
1632 1634
1633 std::wstring WebFrameImpl::GetName() { 1635 std::wstring WebFrameImpl::GetName() {
1634 return webkit_glue::StringToStdWString(frame_->tree()->name()); 1636 return webkit_glue::StringToStdWString(frame_->tree()->name());
1635 } 1637 }
1636 1638
1637 WebTextInput* WebFrameImpl::GetTextInput() { 1639 WebTextInput* WebFrameImpl::GetTextInput() {
1638 if (!webtextinput_impl_.get()) { 1640 if (!webtextinput_impl_.get()) {
1639 webtextinput_impl_.reset(new WebTextInputImpl(this)); 1641 webtextinput_impl_.reset(new WebTextInputImpl(this));
1640 } 1642 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 1850
1849 void WebFrameImpl::AltErrorPageFinished(const GURL& unreachable_url, 1851 void WebFrameImpl::AltErrorPageFinished(const GURL& unreachable_url,
1850 const std::string& html) { 1852 const std::string& html) {
1851 WebViewDelegate* d = GetWebViewImpl()->delegate(); 1853 WebViewDelegate* d = GetWebViewImpl()->delegate();
1852 if (!d) 1854 if (!d)
1853 return; 1855 return;
1854 WebURLError error; 1856 WebURLError error;
1855 error.unreachableURL = unreachable_url; 1857 error.unreachableURL = unreachable_url;
1856 d->LoadNavigationErrorPage(this, WebURLRequest(), error, html, true); 1858 d->LoadNavigationErrorPage(this, WebURLRequest(), error, html, true);
1857 } 1859 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | webkit/tools/test_shell/layout_test_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698