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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 2250263004: [Extensions] Reduce string copy in renderer/ UserScript. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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 | « no previous file | extensions/renderer/programmatic_script_injector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 // we insert the default platform app or extension stylesheet into all 575 // we insert the default platform app or extension stylesheet into all
576 // documents that are loaded in each app or extension. 576 // documents that are loaded in each app or extension.
577 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); 577 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet));
578 } 578 }
579 579
580 // If this is an extension options page, and the extension has opted into 580 // If this is an extension options page, and the extension has opted into
581 // using Chrome styles, then insert the Chrome extension stylesheet. 581 // using Chrome styles, then insert the Chrome extension stylesheet.
582 if (extension && extension->is_extension() && 582 if (extension && extension->is_extension() &&
583 OptionsPageInfo::ShouldUseChromeStyle(extension) && 583 OptionsPageInfo::ShouldUseChromeStyle(extension) &&
584 effective_document_url == OptionsPageInfo::GetOptionsPage(extension)) { 584 effective_document_url == OptionsPageInfo::GetOptionsPage(extension)) {
585 base::StringPiece extension_css =
586 ResourceBundle::GetSharedInstance().GetRawDataResource(
587 IDR_EXTENSION_CSS);
585 frame->document().insertStyleSheet( 588 frame->document().insertStyleSheet(
586 WebString::fromUTF8(ResourceBundle::GetSharedInstance() 589 WebString::fromUTF8(extension_css.data(), extension_css.length()));
587 .GetRawDataResource(IDR_EXTENSION_CSS)
588 .as_string()));
589 } 590 }
590 591
591 // In testing, the document lifetime events can happen after the render 592 // In testing, the document lifetime events can happen after the render
592 // process shutdown event. 593 // process shutdown event.
593 // See: http://crbug.com/21508 and http://crbug.com/500851 594 // See: http://crbug.com/21508 and http://crbug.com/500851
594 if (content_watcher_) { 595 if (content_watcher_) {
595 content_watcher_->DidCreateDocumentElement(frame); 596 content_watcher_->DidCreateDocumentElement(frame);
596 } 597 }
597 } 598 }
598 599
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 // The "guestViewDeny" module must always be loaded last. It registers 1668 // The "guestViewDeny" module must always be loaded last. It registers
1668 // error-providing custom elements for the GuestView types that are not 1669 // error-providing custom elements for the GuestView types that are not
1669 // available, and thus all of those types must have been checked and loaded 1670 // available, and thus all of those types must have been checked and loaded
1670 // (or not loaded) beforehand. 1671 // (or not loaded) beforehand.
1671 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1672 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1672 module_system->Require("guestViewDeny"); 1673 module_system->Require("guestViewDeny");
1673 } 1674 }
1674 } 1675 }
1675 1676
1676 } // namespace extensions 1677 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/programmatic_script_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698