OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 | 2012 |
2013 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( | 2013 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( |
2014 const WebPopupMenuInfo& popup_menu_info, | 2014 const WebPopupMenuInfo& popup_menu_info, |
2015 WebExternalPopupMenuClient* popup_menu_client) { | 2015 WebExternalPopupMenuClient* popup_menu_client) { |
2016 // An IPC message is sent to the browser to build and display the actual | 2016 // An IPC message is sent to the browser to build and display the actual |
2017 // popup. The user could have time to click a different select by the time | 2017 // popup. The user could have time to click a different select by the time |
2018 // the popup is shown. In that case external_popup_menu_ is non NULL. | 2018 // the popup is shown. In that case external_popup_menu_ is non NULL. |
2019 // By returning NULL in that case, we instruct WebKit to cancel that new | 2019 // By returning NULL in that case, we instruct WebKit to cancel that new |
2020 // popup. So from the user perspective, only the first one will show, and | 2020 // popup. So from the user perspective, only the first one will show, and |
2021 // will have to close the first one before another one can be shown. | 2021 // will have to close the first one before another one can be shown. |
2022 if (external_popup_menu_.get()) | 2022 if (external_popup_menu_) |
2023 return NULL; | 2023 return NULL; |
2024 external_popup_menu_.reset( | 2024 external_popup_menu_.reset( |
2025 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 2025 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
2026 return external_popup_menu_.get(); | 2026 return external_popup_menu_.get(); |
2027 } | 2027 } |
2028 | 2028 |
2029 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( | 2029 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer( |
2030 webkit::ppapi::PluginInstance* plugin) { | 2030 webkit::ppapi::PluginInstance* plugin) { |
2031 #if defined(ENABLE_PLUGINS) | 2031 #if defined(ENABLE_PLUGINS) |
2032 GURL active_url; | 2032 GURL active_url; |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 internal_data->set_searchable_form_encoding( | 3115 internal_data->set_searchable_form_encoding( |
3116 web_searchable_form_data.encoding().utf8()); | 3116 web_searchable_form_data.encoding().utf8()); |
3117 scoped_ptr<PasswordForm> password_form_data = | 3117 scoped_ptr<PasswordForm> password_form_data = |
3118 CreatePasswordForm(form); | 3118 CreatePasswordForm(form); |
3119 | 3119 |
3120 // In order to save the password that the user actually typed and not one | 3120 // In order to save the password that the user actually typed and not one |
3121 // that may have gotten transformed by the site prior to submit, recover it | 3121 // that may have gotten transformed by the site prior to submit, recover it |
3122 // from the form contents already stored by |willSendSubmitEvent| into the | 3122 // from the form contents already stored by |willSendSubmitEvent| into the |
3123 // dataSource's NavigationState (as opposed to the provisionalDataSource's, | 3123 // dataSource's NavigationState (as opposed to the provisionalDataSource's, |
3124 // which is what we're storing into now.) | 3124 // which is what we're storing into now.) |
3125 if (password_form_data.get()) { | 3125 if (password_form_data) { |
3126 DocumentState* old_document_state = | 3126 DocumentState* old_document_state = |
3127 DocumentState::FromDataSource(frame->dataSource()); | 3127 DocumentState::FromDataSource(frame->dataSource()); |
3128 if (old_document_state) { | 3128 if (old_document_state) { |
3129 PasswordForm* old_form_data = old_document_state->password_form_data(); | 3129 PasswordForm* old_form_data = old_document_state->password_form_data(); |
3130 if (old_form_data && old_form_data->action == password_form_data->action) | 3130 if (old_form_data && old_form_data->action == password_form_data->action) |
3131 password_form_data->password_value = old_form_data->password_value; | 3131 password_form_data->password_value = old_form_data->password_value; |
3132 } | 3132 } |
3133 } | 3133 } |
3134 | 3134 |
3135 document_state->set_password_form_data(password_form_data.Pass()); | 3135 document_state->set_password_form_data(password_form_data.Pass()); |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 g_view_map.Get().size()); | 3617 g_view_map.Get().size()); |
3618 } | 3618 } |
3619 } | 3619 } |
3620 } | 3620 } |
3621 | 3621 |
3622 void RenderViewImpl::didClearWindowObject(WebFrame* frame) { | 3622 void RenderViewImpl::didClearWindowObject(WebFrame* frame) { |
3623 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 3623 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
3624 DidClearWindowObject(frame)); | 3624 DidClearWindowObject(frame)); |
3625 | 3625 |
3626 if (enabled_bindings_ & BINDINGS_POLICY_DOM_AUTOMATION) { | 3626 if (enabled_bindings_ & BINDINGS_POLICY_DOM_AUTOMATION) { |
3627 if (!dom_automation_controller_.get()) | 3627 if (!dom_automation_controller_) |
3628 dom_automation_controller_.reset(new DomAutomationController()); | 3628 dom_automation_controller_.reset(new DomAutomationController()); |
3629 dom_automation_controller_->set_message_sender( | 3629 dom_automation_controller_->set_message_sender( |
3630 static_cast<RenderView*>(this)); | 3630 static_cast<RenderView*>(this)); |
3631 dom_automation_controller_->set_routing_id(routing_id()); | 3631 dom_automation_controller_->set_routing_id(routing_id()); |
3632 dom_automation_controller_->BindToJavascript(frame, | 3632 dom_automation_controller_->BindToJavascript(frame, |
3633 "domAutomationController"); | 3633 "domAutomationController"); |
3634 } | 3634 } |
3635 } | 3635 } |
3636 | 3636 |
3637 void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) { | 3637 void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) { |
(...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6427 #endif | 6427 #endif |
6428 | 6428 |
6429 #if defined(OS_ANDROID) | 6429 #if defined(OS_ANDROID) |
6430 void RenderViewImpl::OnSelectPopupMenuItems( | 6430 void RenderViewImpl::OnSelectPopupMenuItems( |
6431 bool canceled, | 6431 bool canceled, |
6432 const std::vector<int>& selected_indices) { | 6432 const std::vector<int>& selected_indices) { |
6433 // It is possible to receive more than one of these calls if the user presses | 6433 // It is possible to receive more than one of these calls if the user presses |
6434 // a select faster than it takes for the show-select-popup IPC message to make | 6434 // a select faster than it takes for the show-select-popup IPC message to make |
6435 // it to the browser UI thread. Ignore the extra-messages. | 6435 // it to the browser UI thread. Ignore the extra-messages. |
6436 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. | 6436 // TODO(jcivelli): http:/b/5793321 Implement a better fix, as detailed in bug. |
6437 if (!external_popup_menu_.get()) | 6437 if (!external_popup_menu_) |
6438 return; | 6438 return; |
6439 | 6439 |
6440 external_popup_menu_->DidSelectItems(canceled, selected_indices); | 6440 external_popup_menu_->DidSelectItems(canceled, selected_indices); |
6441 external_popup_menu_.reset(); | 6441 external_popup_menu_.reset(); |
6442 } | 6442 } |
6443 #endif | 6443 #endif |
6444 | 6444 |
6445 void RenderViewImpl::OnContextMenuClosed( | 6445 void RenderViewImpl::OnContextMenuClosed( |
6446 const CustomContextMenuContext& custom_context) { | 6446 const CustomContextMenuContext& custom_context) { |
6447 if (custom_context.request_id) { | 6447 if (custom_context.request_id) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6525 if (!new_total_scale) | 6525 if (!new_total_scale) |
6526 return false; | 6526 return false; |
6527 | 6527 |
6528 gfx::Size canvas_size = gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(), | 6528 gfx::Size canvas_size = gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(), |
6529 new_total_scale)); | 6529 new_total_scale)); |
6530 TransportDIB* transport_dib = NULL; | 6530 TransportDIB* transport_dib = NULL; |
6531 { | 6531 { |
6532 scoped_ptr<skia::PlatformCanvas> canvas( | 6532 scoped_ptr<skia::PlatformCanvas> canvas( |
6533 RenderProcess::current()->GetDrawingCanvas(&transport_dib, | 6533 RenderProcess::current()->GetDrawingCanvas(&transport_dib, |
6534 gfx::Rect(canvas_size))); | 6534 gfx::Rect(canvas_size))); |
6535 if (!canvas.get()) | 6535 if (!canvas) |
6536 return false; | 6536 return false; |
6537 | 6537 |
6538 // TODO(trchen): Cleanup the device scale factor mess. | 6538 // TODO(trchen): Cleanup the device scale factor mess. |
6539 // device scale will be applied in WebKit | 6539 // device scale will be applied in WebKit |
6540 // --> zoom_rect doesn't include device scale, | 6540 // --> zoom_rect doesn't include device scale, |
6541 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 6541 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
6542 canvas->scale(new_total_scale / device_scale_factor_, | 6542 canvas->scale(new_total_scale / device_scale_factor_, |
6543 new_total_scale / device_scale_factor_); | 6543 new_total_scale / device_scale_factor_); |
6544 canvas->translate(-zoom_rect.x() * device_scale_factor_, | 6544 canvas->translate(-zoom_rect.x() * device_scale_factor_, |
6545 -zoom_rect.y() * device_scale_factor_); | 6545 -zoom_rect.y() * device_scale_factor_); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6617 WebURL url = icon_urls[i].iconURL(); | 6617 WebURL url = icon_urls[i].iconURL(); |
6618 if (!url.isEmpty()) | 6618 if (!url.isEmpty()) |
6619 urls.push_back(FaviconURL(url, | 6619 urls.push_back(FaviconURL(url, |
6620 ToFaviconType(icon_urls[i].iconType()))); | 6620 ToFaviconType(icon_urls[i].iconType()))); |
6621 } | 6621 } |
6622 SendUpdateFaviconURL(urls); | 6622 SendUpdateFaviconURL(urls); |
6623 } | 6623 } |
6624 | 6624 |
6625 | 6625 |
6626 } // namespace content | 6626 } // namespace content |
OLD | NEW |