OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 const Extension* extension = | 332 const Extension* extension = |
333 extensions_.GetExtensionOrAppByURL(effective_document_url); | 333 extensions_.GetExtensionOrAppByURL(effective_document_url); |
334 | 334 |
335 if (extension && | 335 if (extension && |
336 (extension->is_extension() || extension->is_platform_app())) { | 336 (extension->is_extension() || extension->is_platform_app())) { |
337 int resource_id = extension->is_platform_app() ? IDR_PLATFORM_APP_CSS | 337 int resource_id = extension->is_platform_app() ? IDR_PLATFORM_APP_CSS |
338 : IDR_EXTENSION_FONTS_CSS; | 338 : IDR_EXTENSION_FONTS_CSS; |
339 std::string stylesheet = ResourceBundle::GetSharedInstance() | 339 std::string stylesheet = ResourceBundle::GetSharedInstance() |
340 .GetRawDataResource(resource_id) | 340 .GetRawDataResource(resource_id) |
341 .as_string(); | 341 .as_string(); |
342 ReplaceFirstSubstringAfterOffset( | 342 base::ReplaceFirstSubstringAfterOffset( |
343 &stylesheet, 0, "$FONTFAMILY", system_font_family_); | 343 &stylesheet, 0, "$FONTFAMILY", system_font_family_); |
344 ReplaceFirstSubstringAfterOffset( | 344 base::ReplaceFirstSubstringAfterOffset( |
345 &stylesheet, 0, "$FONTSIZE", system_font_size_); | 345 &stylesheet, 0, "$FONTSIZE", system_font_size_); |
346 | 346 |
347 // Blink doesn't let us define an additional user agent stylesheet, so | 347 // Blink doesn't let us define an additional user agent stylesheet, so |
348 // we insert the default platform app or extension stylesheet into all | 348 // we insert the default platform app or extension stylesheet into all |
349 // documents that are loaded in each app or extension. | 349 // documents that are loaded in each app or extension. |
350 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); | 350 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); |
351 } | 351 } |
352 | 352 |
353 // If this is an extension options page, and the extension has opted into | 353 // If this is an extension options page, and the extension has opted into |
354 // using Chrome styles, then insert the Chrome extension stylesheet. | 354 // using Chrome styles, then insert the Chrome extension stylesheet. |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 // The "guestViewDeny" module must always be loaded last. It registers | 1442 // The "guestViewDeny" module must always be loaded last. It registers |
1443 // error-providing custom elements for the GuestView types that are not | 1443 // error-providing custom elements for the GuestView types that are not |
1444 // available, and thus all of those types must have been checked and loaded | 1444 // available, and thus all of those types must have been checked and loaded |
1445 // (or not loaded) beforehand. | 1445 // (or not loaded) beforehand. |
1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1447 module_system->Require("guestViewDeny"); | 1447 module_system->Require("guestViewDeny"); |
1448 } | 1448 } |
1449 } | 1449 } |
1450 | 1450 |
1451 } // namespace extensions | 1451 } // namespace extensions |
OLD | NEW |