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 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 page_id_(-1), | 189 page_id_(-1), |
190 last_page_id_sent_to_browser_(-1), | 190 last_page_id_sent_to_browser_(-1), |
191 last_indexed_page_id_(-1), | 191 last_indexed_page_id_(-1), |
192 opened_by_user_gesture_(true), | 192 opened_by_user_gesture_(true), |
193 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 193 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
194 first_default_plugin_(NULL), | 194 first_default_plugin_(NULL), |
195 devtools_agent_(NULL), | 195 devtools_agent_(NULL), |
196 devtools_client_(NULL), | 196 devtools_client_(NULL), |
197 history_back_list_count_(0), | 197 history_back_list_count_(0), |
198 history_forward_list_count_(0), | 198 history_forward_list_count_(0), |
199 disable_popup_blocking_(false), | |
200 has_unload_listener_(false), | 199 has_unload_listener_(false), |
201 decrement_shared_popup_at_destruction_(false), | 200 decrement_shared_popup_at_destruction_(false), |
202 form_field_autofill_request_id_(0), | 201 form_field_autofill_request_id_(0), |
203 popup_notification_visible_(false), | 202 popup_notification_visible_(false), |
204 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync) { | 203 delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync) { |
205 } | 204 } |
206 | 205 |
207 RenderView::~RenderView() { | 206 RenderView::~RenderView() { |
208 if (decrement_shared_popup_at_destruction_) | 207 if (decrement_shared_popup_at_destruction_) |
209 shared_popup_counter_->data--; | 208 shared_popup_counter_->data--; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (opener_id == MSG_ROUTING_NONE) { | 328 if (opener_id == MSG_ROUTING_NONE) { |
330 did_show_ = true; | 329 did_show_ = true; |
331 CompleteInit(parent_hwnd); | 330 CompleteInit(parent_hwnd); |
332 } | 331 } |
333 | 332 |
334 host_window_ = parent_hwnd; | 333 host_window_ = parent_hwnd; |
335 modal_dialog_event_.reset(modal_dialog_event); | 334 modal_dialog_event_.reset(modal_dialog_event); |
336 | 335 |
337 if (command_line.HasSwitch(switches::kDomAutomationController)) | 336 if (command_line.HasSwitch(switches::kDomAutomationController)) |
338 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 337 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
339 disable_popup_blocking_ = | |
340 command_line.HasSwitch(switches::kDisablePopupBlocking); | |
341 | 338 |
342 debug_message_handler_ = new DebugMessageHandler(this); | 339 debug_message_handler_ = new DebugMessageHandler(this); |
343 render_thread_->AddFilter(debug_message_handler_); | 340 render_thread_->AddFilter(debug_message_handler_); |
344 | 341 |
345 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 342 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
346 render_thread_->AddFilter(audio_message_filter_); | 343 render_thread_->AddFilter(audio_message_filter_); |
347 } | 344 } |
348 | 345 |
349 void RenderView::OnMessageReceived(const IPC::Message& message) { | 346 void RenderView::OnMessageReceived(const IPC::Message& message) { |
350 WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; | 347 WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 DCHECK(!did_show_) << "received extraneous Show call"; | 1964 DCHECK(!did_show_) << "received extraneous Show call"; |
1968 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 1965 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
1969 | 1966 |
1970 if (did_show_) | 1967 if (did_show_) |
1971 return; | 1968 return; |
1972 did_show_ = true; | 1969 did_show_ = true; |
1973 | 1970 |
1974 // NOTE: initial_pos_ may still have its default values at this point, but | 1971 // NOTE: initial_pos_ may still have its default values at this point, but |
1975 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 1972 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
1976 // browser process will impose a default position otherwise. | 1973 // browser process will impose a default position otherwise. |
1977 Send(new ViewHostMsg_ShowView( | 1974 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, disposition, |
1978 opener_id_, routing_id_, disposition, initial_pos_, | 1975 initial_pos_, WasOpenedByUserGesture(NULL))); |
1979 WasOpenedByUserGestureHelper())); | |
1980 } | 1976 } |
1981 | 1977 |
1982 void RenderView::CloseWidgetSoon(WebWidget* webwidget) { | 1978 void RenderView::CloseWidgetSoon(WebWidget* webwidget) { |
1983 if (popup_notification_visible_ == false) | 1979 if (popup_notification_visible_ == false) |
1984 RenderWidget::CloseWidgetSoon(webwidget); | 1980 RenderWidget::CloseWidgetSoon(webwidget); |
1985 } | 1981 } |
1986 | 1982 |
1987 void RenderView::RunModal(WebWidget* webwidget) { | 1983 void RenderView::RunModal(WebWidget* webwidget) { |
1988 DCHECK(did_show_) << "should already have shown the view"; | 1984 DCHECK(did_show_) << "should already have shown the view"; |
1989 | 1985 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 // Send the search result over to the browser process. | 2296 // Send the search result over to the browser process. |
2301 Send(new ViewHostMsg_Find_Reply(routing_id_, | 2297 Send(new ViewHostMsg_Find_Reply(routing_id_, |
2302 request_id, | 2298 request_id, |
2303 -1, | 2299 -1, |
2304 selection_rect, | 2300 selection_rect, |
2305 active_match_ordinal, | 2301 active_match_ordinal, |
2306 false)); | 2302 false)); |
2307 } | 2303 } |
2308 | 2304 |
2309 bool RenderView::WasOpenedByUserGesture(WebView* webview) const { | 2305 bool RenderView::WasOpenedByUserGesture(WebView* webview) const { |
2310 return WasOpenedByUserGestureHelper(); | |
2311 } | |
2312 | |
2313 bool RenderView::WasOpenedByUserGestureHelper() const { | |
2314 // If pop-up blocking has been disabled, then treat all new windows as if | |
2315 // they were opened by a user gesture. This will prevent them from being | |
2316 // blocked. This is a bit of a hack, there should be a more straightforward | |
2317 // way to disable pop-up blocking. | |
2318 if (disable_popup_blocking_) | |
2319 return true; | |
2320 | |
2321 return opened_by_user_gesture_; | 2306 return opened_by_user_gesture_; |
2322 } | 2307 } |
2323 | 2308 |
2324 void RenderView::SpellCheck(const std::wstring& word, int& misspell_location, | 2309 void RenderView::SpellCheck(const std::wstring& word, int& misspell_location, |
2325 int& misspell_length) { | 2310 int& misspell_length) { |
2326 Send(new ViewHostMsg_SpellCheck(routing_id_, word, &misspell_location, | 2311 Send(new ViewHostMsg_SpellCheck(routing_id_, word, &misspell_location, |
2327 &misspell_length)); | 2312 &misspell_length)); |
2328 } | 2313 } |
2329 | 2314 |
2330 void RenderView::SetInputMethodState(bool enabled) { | 2315 void RenderView::SetInputMethodState(bool enabled) { |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 } | 2989 } |
3005 } | 2990 } |
3006 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); | 2991 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); |
3007 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); | 2992 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); |
3008 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); | 2993 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); |
3009 if (start_to_first_layout.ToInternalValue() >= 0) { | 2994 if (start_to_first_layout.ToInternalValue() >= 0) { |
3010 UMA_HISTOGRAM_TIMES( | 2995 UMA_HISTOGRAM_TIMES( |
3011 "Renderer.All.StartToFirstLayout", start_to_first_layout); | 2996 "Renderer.All.StartToFirstLayout", start_to_first_layout); |
3012 } | 2997 } |
3013 } | 2998 } |
OLD | NEW |