| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (opener_id == MSG_ROUTING_NONE) { | 320 if (opener_id == MSG_ROUTING_NONE) { |
| 322 did_show_ = true; | 321 did_show_ = true; |
| 323 CompleteInit(parent_hwnd); | 322 CompleteInit(parent_hwnd); |
| 324 } | 323 } |
| 325 | 324 |
| 326 host_window_ = parent_hwnd; | 325 host_window_ = parent_hwnd; |
| 327 modal_dialog_event_.reset(modal_dialog_event); | 326 modal_dialog_event_.reset(modal_dialog_event); |
| 328 | 327 |
| 329 if (command_line.HasSwitch(switches::kDomAutomationController)) | 328 if (command_line.HasSwitch(switches::kDomAutomationController)) |
| 330 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; | 329 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; |
| 331 disable_popup_blocking_ = | |
| 332 command_line.HasSwitch(switches::kDisablePopupBlocking); | |
| 333 | 330 |
| 334 debug_message_handler_ = new DebugMessageHandler(this); | 331 debug_message_handler_ = new DebugMessageHandler(this); |
| 335 render_thread_->AddFilter(debug_message_handler_); | 332 render_thread_->AddFilter(debug_message_handler_); |
| 336 | 333 |
| 337 audio_message_filter_ = new AudioMessageFilter(routing_id_); | 334 audio_message_filter_ = new AudioMessageFilter(routing_id_); |
| 338 render_thread_->AddFilter(audio_message_filter_); | 335 render_thread_->AddFilter(audio_message_filter_); |
| 339 } | 336 } |
| 340 | 337 |
| 341 void RenderView::OnMessageReceived(const IPC::Message& message) { | 338 void RenderView::OnMessageReceived(const IPC::Message& message) { |
| 342 WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; | 339 WebFrame* main_frame = webview() ? webview()->GetMainFrame() : NULL; |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 DCHECK(!did_show_) << "received extraneous Show call"; | 1950 DCHECK(!did_show_) << "received extraneous Show call"; |
| 1954 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 1951 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
| 1955 | 1952 |
| 1956 if (did_show_) | 1953 if (did_show_) |
| 1957 return; | 1954 return; |
| 1958 did_show_ = true; | 1955 did_show_ = true; |
| 1959 | 1956 |
| 1960 // NOTE: initial_pos_ may still have its default values at this point, but | 1957 // NOTE: initial_pos_ may still have its default values at this point, but |
| 1961 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 1958 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
| 1962 // browser process will impose a default position otherwise. | 1959 // browser process will impose a default position otherwise. |
| 1963 Send(new ViewHostMsg_ShowView( | 1960 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, disposition, |
| 1964 opener_id_, routing_id_, disposition, initial_pos_, | 1961 initial_pos_, WasOpenedByUserGesture(NULL))); |
| 1965 WasOpenedByUserGestureHelper())); | |
| 1966 } | 1962 } |
| 1967 | 1963 |
| 1968 void RenderView::CloseWidgetSoon(WebWidget* webwidget) { | 1964 void RenderView::CloseWidgetSoon(WebWidget* webwidget) { |
| 1969 if (popup_notification_visible_ == false) | 1965 if (popup_notification_visible_ == false) |
| 1970 RenderWidget::CloseWidgetSoon(webwidget); | 1966 RenderWidget::CloseWidgetSoon(webwidget); |
| 1971 } | 1967 } |
| 1972 | 1968 |
| 1973 void RenderView::RunModal(WebWidget* webwidget) { | 1969 void RenderView::RunModal(WebWidget* webwidget) { |
| 1974 DCHECK(did_show_) << "should already have shown the view"; | 1970 DCHECK(did_show_) << "should already have shown the view"; |
| 1975 | 1971 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 // Send the search result over to the browser process. | 2282 // Send the search result over to the browser process. |
| 2287 Send(new ViewHostMsg_Find_Reply(routing_id_, | 2283 Send(new ViewHostMsg_Find_Reply(routing_id_, |
| 2288 request_id, | 2284 request_id, |
| 2289 -1, | 2285 -1, |
| 2290 selection_rect, | 2286 selection_rect, |
| 2291 active_match_ordinal, | 2287 active_match_ordinal, |
| 2292 false)); | 2288 false)); |
| 2293 } | 2289 } |
| 2294 | 2290 |
| 2295 bool RenderView::WasOpenedByUserGesture(WebView* webview) const { | 2291 bool RenderView::WasOpenedByUserGesture(WebView* webview) const { |
| 2296 return WasOpenedByUserGestureHelper(); | |
| 2297 } | |
| 2298 | |
| 2299 bool RenderView::WasOpenedByUserGestureHelper() const { | |
| 2300 // If pop-up blocking has been disabled, then treat all new windows as if | |
| 2301 // they were opened by a user gesture. This will prevent them from being | |
| 2302 // blocked. This is a bit of a hack, there should be a more straightforward | |
| 2303 // way to disable pop-up blocking. | |
| 2304 if (disable_popup_blocking_) | |
| 2305 return true; | |
| 2306 | |
| 2307 return opened_by_user_gesture_; | 2292 return opened_by_user_gesture_; |
| 2308 } | 2293 } |
| 2309 | 2294 |
| 2310 void RenderView::SpellCheck(const std::wstring& word, int& misspell_location, | 2295 void RenderView::SpellCheck(const std::wstring& word, int& misspell_location, |
| 2311 int& misspell_length) { | 2296 int& misspell_length) { |
| 2312 Send(new ViewHostMsg_SpellCheck(routing_id_, word, &misspell_location, | 2297 Send(new ViewHostMsg_SpellCheck(routing_id_, word, &misspell_location, |
| 2313 &misspell_length)); | 2298 &misspell_length)); |
| 2314 } | 2299 } |
| 2315 | 2300 |
| 2316 void RenderView::SetInputMethodState(bool enabled) { | 2301 void RenderView::SetInputMethodState(bool enabled) { |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2999 } | 2984 } |
| 3000 } | 2985 } |
| 3001 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); | 2986 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); |
| 3002 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); | 2987 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); |
| 3003 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); | 2988 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); |
| 3004 if (start_to_first_layout.ToInternalValue() >= 0) { | 2989 if (start_to_first_layout.ToInternalValue() >= 0) { |
| 3005 UMA_HISTOGRAM_TIMES( | 2990 UMA_HISTOGRAM_TIMES( |
| 3006 "Renderer.All.StartToFirstLayout", start_to_first_layout); | 2991 "Renderer.All.StartToFirstLayout", start_to_first_layout); |
| 3007 } | 2992 } |
| 3008 } | 2993 } |
| OLD | NEW |