OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/renderer_host/render_view_host.h" | 5 #include "chrome/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/waitable_event.h" | 14 #include "base/waitable_event.h" |
15 #include "chrome/browser/child_process_security_policy.h" | 15 #include "chrome/browser/child_process_security_policy.h" |
16 #include "chrome/browser/cross_site_request_manager.h" | 16 #include "chrome/browser/cross_site_request_manager.h" |
17 #include "chrome/browser/debugger/devtools_manager.h" | 17 #include "chrome/browser/debugger/devtools_manager.h" |
| 18 #include "chrome/browser/dom_operation_notification_details.h" |
18 #include "chrome/browser/extensions/extension_message_service.h" | 19 #include "chrome/browser/extensions/extension_message_service.h" |
19 #include "chrome/browser/metrics/user_metrics.h" | 20 #include "chrome/browser/metrics/user_metrics.h" |
20 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
21 #include "chrome/browser/renderer_host/render_process_host.h" | 22 #include "chrome/browser/renderer_host/render_process_host.h" |
22 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 23 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
23 #include "chrome/browser/renderer_host/render_widget_host.h" | 24 #include "chrome/browser/renderer_host/render_widget_host.h" |
24 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 25 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
25 #include "chrome/browser/renderer_host/site_instance.h" | 26 #include "chrome/browser/renderer_host/site_instance.h" |
26 #include "chrome/common/bindings_policy.h" | 27 #include "chrome/common/bindings_policy.h" |
| 28 #include "chrome/common/notification_details.h" |
27 #include "chrome/common/notification_service.h" | 29 #include "chrome/common/notification_service.h" |
28 #include "chrome/common/notification_type.h" | 30 #include "chrome/common/notification_type.h" |
29 #include "chrome/common/render_messages.h" | 31 #include "chrome/common/render_messages.h" |
30 #include "chrome/common/result_codes.h" | 32 #include "chrome/common/result_codes.h" |
31 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/thumbnail_score.h" | 34 #include "chrome/common/thumbnail_score.h" |
33 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
34 #include "net/base/net_util.h" | 36 #include "net/base/net_util.h" |
35 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
36 #include "webkit/api/public/WebFindOptions.h" | 38 #include "webkit/api/public/WebFindOptions.h" |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 void RenderViewHost::OnMsgDidContentsPreferredWidthChange(int pref_width) { | 1038 void RenderViewHost::OnMsgDidContentsPreferredWidthChange(int pref_width) { |
1037 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); | 1039 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); |
1038 if (!view) | 1040 if (!view) |
1039 return; | 1041 return; |
1040 view->UpdatePreferredWidth(pref_width); | 1042 view->UpdatePreferredWidth(pref_width); |
1041 } | 1043 } |
1042 | 1044 |
1043 void RenderViewHost::OnMsgDomOperationResponse( | 1045 void RenderViewHost::OnMsgDomOperationResponse( |
1044 const std::string& json_string, int automation_id) { | 1046 const std::string& json_string, int automation_id) { |
1045 delegate_->DomOperationResponse(json_string, automation_id); | 1047 delegate_->DomOperationResponse(json_string, automation_id); |
| 1048 |
| 1049 // We also fire a notification for more loosely-coupled use cases. |
| 1050 DomOperationNotificationDetails details(json_string, automation_id); |
| 1051 NotificationService::current()->Notify( |
| 1052 NotificationType::DOM_OPERATION_RESPONSE, Source<RenderViewHost>(this), |
| 1053 Details<DomOperationNotificationDetails>(&details)); |
1046 } | 1054 } |
1047 | 1055 |
1048 void RenderViewHost::OnMsgDOMUISend( | 1056 void RenderViewHost::OnMsgDOMUISend( |
1049 const std::string& message, const std::string& content) { | 1057 const std::string& message, const std::string& content) { |
1050 if (!ChildProcessSecurityPolicy::GetInstance()-> | 1058 if (!ChildProcessSecurityPolicy::GetInstance()-> |
1051 HasDOMUIBindings(process()->pid())) { | 1059 HasDOMUIBindings(process()->pid())) { |
1052 NOTREACHED() << "Blocked unauthorized use of DOMUIBindings."; | 1060 NOTREACHED() << "Blocked unauthorized use of DOMUIBindings."; |
1053 return; | 1061 return; |
1054 } | 1062 } |
1055 | 1063 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 BrowserAccessibilityManager::GetInstance()-> | 1398 BrowserAccessibilityManager::GetInstance()-> |
1391 ChangeAccessibilityFocus(acc_obj_id, process()->pid(), routing_id()); | 1399 ChangeAccessibilityFocus(acc_obj_id, process()->pid(), routing_id()); |
1392 #else | 1400 #else |
1393 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. | 1401 // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. |
1394 #endif | 1402 #endif |
1395 } | 1403 } |
1396 | 1404 |
1397 void RenderViewHost::OnCSSInserted() { | 1405 void RenderViewHost::OnCSSInserted() { |
1398 delegate_->DidInsertCSS(); | 1406 delegate_->DidInsertCSS(); |
1399 } | 1407 } |
OLD | NEW |