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/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 |
11 #include "app/gfx/color_utils.h" | 11 #include "app/gfx/color_utils.h" |
12 #include "app/gfx/favicon_size.h" | 12 #include "app/gfx/favicon_size.h" |
13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
14 #include "app/message_box_flags.h" | 14 #include "app/message_box_flags.h" |
15 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/field_trial.h" | 18 #include "base/field_trial.h" |
19 #include "base/gfx/png_encoder.h" | 19 #include "base/gfx/png_encoder.h" |
20 #include "base/gfx/native_widget_types.h" | 20 #include "base/gfx/native_widget_types.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| 22 #include "base/singleton.h" |
22 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
23 #include "base/string_util.h" | 24 #include "base/string_util.h" |
24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
25 #include "chrome/common/bindings_policy.h" | 26 #include "chrome/common/bindings_policy.h" |
26 #include "chrome/common/child_process_logging.h" | 27 #include "chrome/common/child_process_logging.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
29 #include "chrome/common/jstemplate_builder.h" | 30 #include "chrome/common/jstemplate_builder.h" |
30 #include "chrome/common/page_zoom.h" | 31 #include "chrome/common/page_zoom.h" |
31 #include "chrome/common/render_messages.h" | 32 #include "chrome/common/render_messages.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 history_back_list_count_(0), | 195 history_back_list_count_(0), |
195 history_forward_list_count_(0), | 196 history_forward_list_count_(0), |
196 has_unload_listener_(false), | 197 has_unload_listener_(false), |
197 decrement_shared_popup_at_destruction_(false), | 198 decrement_shared_popup_at_destruction_(false), |
198 form_field_autofill_request_id_(0), | 199 form_field_autofill_request_id_(0), |
199 popup_notification_visible_(false), | 200 popup_notification_visible_(false), |
200 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync), | 201 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync), |
201 preferred_width_(0), | 202 preferred_width_(0), |
202 send_preferred_width_changes_(false), | 203 send_preferred_width_changes_(false), |
203 determine_page_text_after_loading_stops_(false), | 204 determine_page_text_after_loading_stops_(false), |
| 205 view_type_(ViewType::INVALID), |
| 206 browser_window_id_(-1), |
204 last_top_level_navigation_page_id_(-1) { | 207 last_top_level_navigation_page_id_(-1) { |
| 208 Singleton<RenderViewSet>()->render_view_set_.insert(this); |
205 } | 209 } |
206 | 210 |
207 RenderView::~RenderView() { | 211 RenderView::~RenderView() { |
| 212 Singleton<RenderViewSet>()->render_view_set_.erase(this); |
208 if (decrement_shared_popup_at_destruction_) | 213 if (decrement_shared_popup_at_destruction_) |
209 shared_popup_counter_->data--; | 214 shared_popup_counter_->data--; |
210 | 215 |
211 // Clear any back-pointers that might still be held by plugins. | 216 // Clear any back-pointers that might still be held by plugins. |
212 PluginDelegateList::iterator it = plugin_delegates_.begin(); | 217 PluginDelegateList::iterator it = plugin_delegates_.begin(); |
213 while (it != plugin_delegates_.end()) { | 218 while (it != plugin_delegates_.end()) { |
214 (*it)->DropRenderView(); | 219 (*it)->DropRenderView(); |
215 it = plugin_delegates_.erase(it); | 220 it = plugin_delegates_.erase(it); |
216 } | 221 } |
217 | 222 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 OnPopupNotificationVisibilityChanged) | 425 OnPopupNotificationVisibilityChanged) |
421 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 426 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
422 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) | 427 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionResponse, OnExtensionResponse) |
423 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, | 428 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, |
424 OnExtensionMessageInvoke) | 429 OnExtensionMessageInvoke) |
425 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) | 430 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedNode, OnClearFocusedNode) |
426 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) | 431 IPC_MESSAGE_HANDLER(ViewMsg_SetBackground, OnSetBackground) |
427 IPC_MESSAGE_HANDLER(ViewMsg_EnableIntrinsicWidthChangedMode, | 432 IPC_MESSAGE_HANDLER(ViewMsg_EnableIntrinsicWidthChangedMode, |
428 OnEnableIntrinsicWidthChangedMode) | 433 OnEnableIntrinsicWidthChangedMode) |
429 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) | 434 IPC_MESSAGE_HANDLER(ViewMsg_SetRendererPrefs, OnSetRendererPrefs) |
| 435 IPC_MESSAGE_HANDLER(ViewMsg_UpdateBrowserWindowId, |
| 436 OnUpdateBrowserWindowId) |
| 437 IPC_MESSAGE_HANDLER(ViewMsg_NotifyRenderViewType, |
| 438 OnNotifyRendererViewType) |
430 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) | 439 IPC_MESSAGE_HANDLER(ViewMsg_MediaPlayerActionAt, OnMediaPlayerActionAt) |
431 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 440 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
432 | 441 |
433 // Have the super handle all other messages. | 442 // Have the super handle all other messages. |
434 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) | 443 IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) |
435 IPC_END_MESSAGE_MAP() | 444 IPC_END_MESSAGE_MAP() |
436 } | 445 } |
437 | 446 |
438 void RenderView::SendThumbnail() { | 447 void RenderView::SendThumbnail() { |
439 WebFrame* main_frame = webview()->GetMainFrame(); | 448 WebFrame* main_frame = webview()->GetMainFrame(); |
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2770 | 2779 |
2771 void RenderView::OnMediaPlayerActionAt(int x, | 2780 void RenderView::OnMediaPlayerActionAt(int x, |
2772 int y, | 2781 int y, |
2773 const MediaPlayerAction& action) { | 2782 const MediaPlayerAction& action) { |
2774 if (!webview()) | 2783 if (!webview()) |
2775 return; | 2784 return; |
2776 | 2785 |
2777 webview()->MediaPlayerActionAt(x, y, action); | 2786 webview()->MediaPlayerActionAt(x, y, action); |
2778 } | 2787 } |
2779 | 2788 |
| 2789 void RenderView::OnNotifyRendererViewType(ViewType::Type type) { |
| 2790 view_type_ = type; |
| 2791 } |
| 2792 |
| 2793 void RenderView::OnUpdateBrowserWindowId(int window_id) { |
| 2794 browser_window_id_ = window_id; |
| 2795 } |
| 2796 |
2780 void RenderView::OnUpdateBackForwardListCount(int back_list_count, | 2797 void RenderView::OnUpdateBackForwardListCount(int back_list_count, |
2781 int forward_list_count) { | 2798 int forward_list_count) { |
2782 history_back_list_count_ = back_list_count; | 2799 history_back_list_count_ = back_list_count; |
2783 history_forward_list_count_ = forward_list_count; | 2800 history_forward_list_count_ = forward_list_count; |
2784 } | 2801 } |
2785 | 2802 |
2786 void RenderView::OnGetAccessibilityInfo( | 2803 void RenderView::OnGetAccessibilityInfo( |
2787 const webkit_glue::WebAccessibility::InParams& in_params, | 2804 const webkit_glue::WebAccessibility::InParams& in_params, |
2788 webkit_glue::WebAccessibility::OutParams* out_params) { | 2805 webkit_glue::WebAccessibility::OutParams* out_params) { |
2789 #if defined(OS_WIN) | 2806 #if defined(OS_WIN) |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3316 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
3300 } | 3317 } |
3301 | 3318 |
3302 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3319 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
3303 DCHECK(frame); | 3320 DCHECK(frame); |
3304 if (print_helper_.get() == NULL) { | 3321 if (print_helper_.get() == NULL) { |
3305 print_helper_.reset(new PrintWebViewHelper(this)); | 3322 print_helper_.reset(new PrintWebViewHelper(this)); |
3306 } | 3323 } |
3307 print_helper_->Print(frame, script_initiated); | 3324 print_helper_->Print(frame, script_initiated); |
3308 } | 3325 } |
OLD | NEW |