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

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

Issue 204022: ExtensionShelf now uses the BookmarkExtensionBackground, just like the Bookma... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | no next file » | 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // Returns the V8 context for this frame, or an empty handle if there is 694 // Returns the V8 context for this frame, or an empty handle if there is
695 // none. 695 // none.
696 v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const { 696 v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const {
697 if (!frame_) 697 if (!frame_)
698 return v8::Local<v8::Context>(); 698 return v8::Local<v8::Context>();
699 699
700 return WebCore::V8Proxy::mainWorldContext(frame_); 700 return WebCore::V8Proxy::mainWorldContext(frame_);
701 } 701 }
702 #endif 702 #endif
703 703
704 bool WebFrameImpl::insertStyleText(const WebString& css) { 704 bool WebFrameImpl::insertStyleText(
705 const WebString& css, const WebString& id) {
705 Document* document = frame()->document(); 706 Document* document = frame()->document();
706 if (!document) 707 if (!document)
707 return false; 708 return false;
708 WebCore::Element* document_element = document->documentElement(); 709 WebCore::Element* document_element = document->documentElement();
709 if (!document_element) 710 if (!document_element)
710 return false; 711 return false;
711 712
713 ExceptionCode err = 0;
714
715 if (!id.isEmpty()) {
716 WebCore::Element* old_element =
717 document->getElementById(webkit_glue::WebStringToString(id));
718 if (old_element) {
719 Node* parent = old_element->parent();
720 if (!parent)
721 return false;
722 parent->removeChild(old_element, err);
723 }
724 }
725
712 RefPtr<WebCore::Element> stylesheet = document->createElement( 726 RefPtr<WebCore::Element> stylesheet = document->createElement(
713 WebCore::HTMLNames::styleTag, false); 727 WebCore::HTMLNames::styleTag, false);
714 ExceptionCode err = 0; 728 if (!id.isEmpty())
729 stylesheet->setAttribute(WebCore::HTMLNames::idAttr,
730 webkit_glue::WebStringToString(id));
715 stylesheet->setTextContent(webkit_glue::WebStringToString(css), err); 731 stylesheet->setTextContent(webkit_glue::WebStringToString(css), err);
716 DCHECK(!err) << "Failed to set style element content"; 732 DCHECK(!err) << "Failed to set style element content";
717 WebCore::Node* first = document_element->firstChild(); 733 WebCore::Node* first = document_element->firstChild();
718 bool success = document_element->insertBefore(stylesheet, first, err); 734 bool success = document_element->insertBefore(stylesheet, first, err);
719 DCHECK(success) << "Failed to insert stylesheet"; 735 DCHECK(success) << "Failed to insert stylesheet";
720 return success; 736 return success;
721 } 737 }
722 738
723 void WebFrameImpl::reload() { 739 void WebFrameImpl::reload() {
724 frame_->loader()->saveDocumentAndScrollState(); 740 frame_->loader()->saveDocumentAndScrollState();
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 1898
1883 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); 1899 SecurityOrigin* security_origin = frame_->document()->securityOrigin();
1884 1900
1885 if (!frame_->loader()->isScheduledLocationChangePending()) { 1901 if (!frame_->loader()->isScheduledLocationChangePending()) {
1886 frame_->loader()->stopAllLoaders(); 1902 frame_->loader()->stopAllLoaders();
1887 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); 1903 frame_->loader()->begin(frame_->loader()->url(), true, security_origin);
1888 frame_->loader()->write(script_result); 1904 frame_->loader()->write(script_result);
1889 frame_->loader()->end(); 1905 frame_->loader()->end();
1890 } 1906 }
1891 } 1907 }
OLDNEW
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698