OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/gfx/color_utils.h" | 21 #include "chrome/common/gfx/color_utils.h" |
22 #include "chrome/common/jstemplate_builder.h" | 22 #include "chrome/common/jstemplate_builder.h" |
23 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
24 #include "chrome/common/page_zoom.h" | 24 #include "chrome/common/page_zoom.h" |
25 #include "chrome/common/resource_bundle.h" | 25 #include "chrome/common/resource_bundle.h" |
26 #include "chrome/common/thumbnail_score.h" | 26 #include "chrome/common/thumbnail_score.h" |
27 #include "chrome/common/chrome_plugin_lib.h" | 27 #include "chrome/common/chrome_plugin_lib.h" |
28 #include "chrome/renderer/about_handler.h" | 28 #include "chrome/renderer/about_handler.h" |
29 #include "chrome/renderer/chrome_plugin_host.h" | 29 #include "chrome/renderer/chrome_plugin_host.h" |
30 #include "chrome/renderer/debug_message_handler.h" | 30 #include "chrome/renderer/debug_message_handler.h" |
31 #include "chrome/renderer/greasemonkey_slave.h" | |
32 #include "chrome/renderer/localized_error.h" | 31 #include "chrome/renderer/localized_error.h" |
33 #include "chrome/renderer/renderer_resources.h" | 32 #include "chrome/renderer/renderer_resources.h" |
| 33 #include "chrome/renderer/user_script_slave.h" |
34 #include "chrome/renderer/visitedlink_slave.h" | 34 #include "chrome/renderer/visitedlink_slave.h" |
35 #include "chrome/renderer/webmediaplayer_delegate_impl.h" | 35 #include "chrome/renderer/webmediaplayer_delegate_impl.h" |
36 #include "chrome/renderer/webplugin_delegate_proxy.h" | 36 #include "chrome/renderer/webplugin_delegate_proxy.h" |
37 #include "chrome/views/message_box_view.h" | 37 #include "chrome/views/message_box_view.h" |
38 #include "net/base/escape.h" | 38 #include "net/base/escape.h" |
39 #include "net/base/net_errors.h" | 39 #include "net/base/net_errors.h" |
40 #include "skia/ext/bitmap_platform_device.h" | 40 #include "skia/ext/bitmap_platform_device.h" |
41 #include "skia/ext/image_operations.h" | 41 #include "skia/ext/image_operations.h" |
42 #include "skia/ext/vector_canvas.h" | 42 #include "skia/ext/vector_canvas.h" |
43 #include "webkit/default_plugin/default_plugin_shared.h" | 43 #include "webkit/default_plugin/default_plugin_shared.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 last_indexed_page_id_(-1), | 155 last_indexed_page_id_(-1), |
156 opened_by_user_gesture_(true), | 156 opened_by_user_gesture_(true), |
157 method_factory_(this), | 157 method_factory_(this), |
158 first_default_plugin_(NULL), | 158 first_default_plugin_(NULL), |
159 printed_document_width_(0), | 159 printed_document_width_(0), |
160 history_back_list_count_(0), | 160 history_back_list_count_(0), |
161 history_forward_list_count_(0), | 161 history_forward_list_count_(0), |
162 disable_popup_blocking_(false), | 162 disable_popup_blocking_(false), |
163 has_unload_listener_(false), | 163 has_unload_listener_(false), |
164 decrement_shared_popup_at_destruction_(false), | 164 decrement_shared_popup_at_destruction_(false), |
165 greasemonkey_enabled_(false), | 165 user_scripts_enabled_(false), |
166 waiting_for_create_window_ack_(false), | 166 waiting_for_create_window_ack_(false), |
167 form_field_autofill_request_id_(0), | 167 form_field_autofill_request_id_(0), |
168 popup_notification_visible_(false), | 168 popup_notification_visible_(false), |
169 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync) { | 169 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync) { |
170 resource_dispatcher_ = new ResourceDispatcher(this); | 170 resource_dispatcher_ = new ResourceDispatcher(this); |
171 #ifdef CHROME_PERSONALIZATION | 171 #ifdef CHROME_PERSONALIZATION |
172 personalization_ = Personalization::CreateRendererPersonalization(); | 172 personalization_ = Personalization::CreateRendererPersonalization(); |
173 #endif | 173 #endif |
174 } | 174 } |
175 | 175 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 host_window_ = parent_hwnd; | 289 host_window_ = parent_hwnd; |
290 modal_dialog_event_.Set(modal_dialog_event); | 290 modal_dialog_event_.Set(modal_dialog_event); |
291 | 291 |
292 CommandLine command_line; | 292 CommandLine command_line; |
293 enable_dom_automation_ = | 293 enable_dom_automation_ = |
294 command_line.HasSwitch(switches::kDomAutomationController); | 294 command_line.HasSwitch(switches::kDomAutomationController); |
295 disable_popup_blocking_ = | 295 disable_popup_blocking_ = |
296 command_line.HasSwitch(switches::kDisablePopupBlocking); | 296 command_line.HasSwitch(switches::kDisablePopupBlocking); |
297 greasemonkey_enabled_ = | 297 user_scripts_enabled_ = |
298 command_line.HasSwitch(switches::kEnableGreasemonkey); | 298 command_line.HasSwitch(switches::kEnableUserScripts); |
299 | 299 |
300 debug_message_handler_ = new DebugMessageHandler(this); | 300 debug_message_handler_ = new DebugMessageHandler(this); |
301 render_thread_->AddFilter(debug_message_handler_); | 301 render_thread_->AddFilter(debug_message_handler_); |
302 } | 302 } |
303 | 303 |
304 void RenderView::OnMessageReceived(const IPC::Message& message) { | 304 void RenderView::OnMessageReceived(const IPC::Message& message) { |
305 // If the current RenderView instance represents a popup, then we | 305 // If the current RenderView instance represents a popup, then we |
306 // need to wait for ViewMsg_CreatingNew_ACK to be sent by the browser. | 306 // need to wait for ViewMsg_CreatingNew_ACK to be sent by the browser. |
307 // As part of this ack we also receive the browser window handle, which | 307 // As part of this ack we also receive the browser window handle, which |
308 // parents any plugins instantiated in this RenderView instance. | 308 // parents any plugins instantiated in this RenderView instance. |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 void RenderView::DidFailLoadWithError(WebView* webview, | 1450 void RenderView::DidFailLoadWithError(WebView* webview, |
1451 const WebError& error, | 1451 const WebError& error, |
1452 WebFrame* frame) { | 1452 WebFrame* frame) { |
1453 } | 1453 } |
1454 | 1454 |
1455 void RenderView::DidFinishDocumentLoadForFrame(WebView* webview, | 1455 void RenderView::DidFinishDocumentLoadForFrame(WebView* webview, |
1456 WebFrame* frame) { | 1456 WebFrame* frame) { |
1457 // Check whether we have new encoding name. | 1457 // Check whether we have new encoding name. |
1458 UpdateEncoding(frame, webview->GetMainFrameEncodingName()); | 1458 UpdateEncoding(frame, webview->GetMainFrameEncodingName()); |
1459 | 1459 |
1460 // Inject any Greasemonkey scripts. Do not inject into chrome UI pages, but | 1460 // Inject any user scripts. Do not inject into chrome UI pages, but do inject |
1461 // do inject into any other document. | 1461 // into any other document. |
1462 if (greasemonkey_enabled_) { | 1462 if (user_scripts_enabled_) { |
1463 const GURL &gurl = frame->GetURL(); | 1463 const GURL &gurl = frame->GetURL(); |
1464 if (g_render_thread && // Will be NULL when testing. | 1464 if (g_render_thread && // Will be NULL when testing. |
1465 (gurl.SchemeIs("file") || | 1465 (gurl.SchemeIs("file") || |
1466 gurl.SchemeIs("http") || | 1466 gurl.SchemeIs("http") || |
1467 gurl.SchemeIs("https"))) { | 1467 gurl.SchemeIs("https"))) { |
1468 g_render_thread->greasemonkey_slave()->InjectScripts(frame); | 1468 g_render_thread->user_script_slave()->InjectScripts(frame); |
1469 } | 1469 } |
1470 } | 1470 } |
1471 } | 1471 } |
1472 | 1472 |
1473 void RenderView::DidHandleOnloadEventsForFrame(WebView* webview, | 1473 void RenderView::DidHandleOnloadEventsForFrame(WebView* webview, |
1474 WebFrame* frame) { | 1474 WebFrame* frame) { |
1475 } | 1475 } |
1476 | 1476 |
1477 void RenderView::DidChangeLocationWithinPageForFrame(WebView* webview, | 1477 void RenderView::DidChangeLocationWithinPageForFrame(WebView* webview, |
1478 WebFrame* frame, | 1478 WebFrame* frame, |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 template_resource_id)); | 2762 template_resource_id)); |
2763 | 2763 |
2764 if (template_html.empty()) { | 2764 if (template_html.empty()) { |
2765 NOTREACHED() << "unable to load template. ID: " << template_resource_id; | 2765 NOTREACHED() << "unable to load template. ID: " << template_resource_id; |
2766 return ""; | 2766 return ""; |
2767 } | 2767 } |
2768 // "t" is the id of the templates root node. | 2768 // "t" is the id of the templates root node. |
2769 return jstemplate_builder::GetTemplateHtml( | 2769 return jstemplate_builder::GetTemplateHtml( |
2770 template_html, &error_strings, "t"); | 2770 template_html, &error_strings, "t"); |
2771 } | 2771 } |
OLD | NEW |