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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "extensions/renderer/safe_builtins.h" | 66 #include "extensions/renderer/safe_builtins.h" |
67 #include "extensions/renderer/script_context.h" | 67 #include "extensions/renderer/script_context.h" |
68 #include "extensions/renderer/script_context_set.h" | 68 #include "extensions/renderer/script_context_set.h" |
69 #include "extensions/renderer/send_request_natives.h" | 69 #include "extensions/renderer/send_request_natives.h" |
70 #include "extensions/renderer/set_icon_natives.h" | 70 #include "extensions/renderer/set_icon_natives.h" |
71 #include "extensions/renderer/test_features_native_handler.h" | 71 #include "extensions/renderer/test_features_native_handler.h" |
72 #include "extensions/renderer/user_gestures_native_handler.h" | 72 #include "extensions/renderer/user_gestures_native_handler.h" |
73 #include "extensions/renderer/user_script_slave.h" | 73 #include "extensions/renderer/user_script_slave.h" |
74 #include "extensions/renderer/utils_native_handler.h" | 74 #include "extensions/renderer/utils_native_handler.h" |
75 #include "extensions/renderer/v8_context_native_handler.h" | 75 #include "extensions/renderer/v8_context_native_handler.h" |
76 #include "grit/renderer_resources.h" | 76 #include "grit/extensions_renderer_resources.h" |
77 #include "third_party/WebKit/public/platform/WebString.h" | 77 #include "third_party/WebKit/public/platform/WebString.h" |
78 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 78 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
79 #include "third_party/WebKit/public/web/WebCustomElement.h" | 79 #include "third_party/WebKit/public/web/WebCustomElement.h" |
80 #include "third_party/WebKit/public/web/WebDataSource.h" | 80 #include "third_party/WebKit/public/web/WebDataSource.h" |
81 #include "third_party/WebKit/public/web/WebDocument.h" | 81 #include "third_party/WebKit/public/web/WebDocument.h" |
82 #include "third_party/WebKit/public/web/WebFrame.h" | 82 #include "third_party/WebKit/public/web/WebFrame.h" |
83 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 83 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
84 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 84 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
85 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 85 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
86 #include "third_party/WebKit/public/web/WebView.h" | 86 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 script_context_set_.Remove(context); | 312 script_context_set_.Remove(context); |
313 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); | 313 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); |
314 } | 314 } |
315 | 315 |
316 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { | 316 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { |
317 if (IsWithinPlatformApp()) { | 317 if (IsWithinPlatformApp()) { |
318 // WebKit doesn't let us define an additional user agent stylesheet, so we | 318 // WebKit doesn't let us define an additional user agent stylesheet, so we |
319 // insert the default platform app stylesheet into all documents that are | 319 // insert the default platform app stylesheet into all documents that are |
320 // loaded in each app. | 320 // loaded in each app. |
| 321 |
321 std::string stylesheet = ResourceBundle::GetSharedInstance() | 322 std::string stylesheet = ResourceBundle::GetSharedInstance() |
322 .GetRawDataResource(IDR_PLATFORM_APP_CSS) | 323 .GetRawDataResource(IDR_PLATFORM_APP_CSS) |
323 .as_string(); | 324 .as_string(); |
324 ReplaceFirstSubstringAfterOffset( | 325 ReplaceFirstSubstringAfterOffset( |
325 &stylesheet, 0, "$FONTFAMILY", system_font_family_); | 326 &stylesheet, 0, "$FONTFAMILY", system_font_family_); |
326 ReplaceFirstSubstringAfterOffset( | 327 ReplaceFirstSubstringAfterOffset( |
327 &stylesheet, 0, "$FONTSIZE", system_font_size_); | 328 &stylesheet, 0, "$FONTSIZE", system_font_size_); |
328 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); | 329 frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet)); |
329 } | 330 } |
330 | 331 |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 return v8::Handle<v8::Object>(); | 1214 return v8::Handle<v8::Object>(); |
1214 | 1215 |
1215 if (bind_name) | 1216 if (bind_name) |
1216 *bind_name = split.back(); | 1217 *bind_name = split.back(); |
1217 | 1218 |
1218 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1219 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1219 : bind_object; | 1220 : bind_object; |
1220 } | 1221 } |
1221 | 1222 |
1222 } // namespace extensions | 1223 } // namespace extensions |
OLD | NEW |