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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 history_list_offset_(-1), | 646 history_list_offset_(-1), |
647 history_list_length_(0), | 647 history_list_length_(0), |
648 frames_in_progress_(0), | 648 frames_in_progress_(0), |
649 target_url_status_(TARGET_NONE), | 649 target_url_status_(TARGET_NONE), |
650 uses_temporary_zoom_level_(false), | 650 uses_temporary_zoom_level_(false), |
651 #if defined(OS_ANDROID) | 651 #if defined(OS_ANDROID) |
652 top_controls_constraints_(cc::BOTH), | 652 top_controls_constraints_(cc::BOTH), |
653 #endif | 653 #endif |
654 has_scrolled_focused_editable_node_into_rect_(false), | 654 has_scrolled_focused_editable_node_into_rect_(false), |
655 speech_recognition_dispatcher_(NULL), | 655 speech_recognition_dispatcher_(NULL), |
656 browser_plugin_manager_(NULL), | |
657 devtools_agent_(NULL), | 656 devtools_agent_(NULL), |
658 mouse_lock_dispatcher_(NULL), | 657 mouse_lock_dispatcher_(NULL), |
659 #if defined(OS_ANDROID) | 658 #if defined(OS_ANDROID) |
660 expected_content_intent_id_(0), | 659 expected_content_intent_id_(0), |
661 #endif | 660 #endif |
662 #if defined(OS_WIN) | 661 #if defined(OS_WIN) |
663 focused_plugin_id_(-1), | 662 focused_plugin_id_(-1), |
664 #endif | 663 #endif |
665 #if defined(ENABLE_PLUGINS) | 664 #if defined(ENABLE_PLUGINS) |
666 plugin_find_handler_(NULL), | 665 plugin_find_handler_(NULL), |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 | 2366 |
2368 gfx::Size size = webview()->contentsPreferredMinimumSize(); | 2367 gfx::Size size = webview()->contentsPreferredMinimumSize(); |
2369 if (size == preferred_size_) | 2368 if (size == preferred_size_) |
2370 return; | 2369 return; |
2371 | 2370 |
2372 preferred_size_ = size; | 2371 preferred_size_ = size; |
2373 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 2372 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
2374 preferred_size_)); | 2373 preferred_size_)); |
2375 } | 2374 } |
2376 | 2375 |
2377 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { | |
2378 if (!browser_plugin_manager_.get()) | |
2379 browser_plugin_manager_ = BrowserPluginManager::Create(this); | |
2380 return browser_plugin_manager_.get(); | |
2381 } | |
2382 | |
2383 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { | 2376 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
2384 StartNavStateSyncTimerIfNecessary(); | 2377 StartNavStateSyncTimerIfNecessary(); |
2385 } | 2378 } |
2386 | 2379 |
2387 void RenderViewImpl::SendFindReply(int request_id, | 2380 void RenderViewImpl::SendFindReply(int request_id, |
2388 int match_count, | 2381 int match_count, |
2389 int ordinal, | 2382 int ordinal, |
2390 const WebRect& selection_rect, | 2383 const WebRect& selection_rect, |
2391 bool final_status_update) { | 2384 bool final_status_update) { |
2392 Send(new ViewHostMsg_Find_Reply(routing_id_, | 2385 Send(new ViewHostMsg_Find_Reply(routing_id_, |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3484 #endif | 3477 #endif |
3485 (*plugin_it)->SetContentAreaFocus(enable); | 3478 (*plugin_it)->SetContentAreaFocus(enable); |
3486 } | 3479 } |
3487 } | 3480 } |
3488 // Notify all Pepper plugins. | 3481 // Notify all Pepper plugins. |
3489 for (PepperPluginSet::iterator i = active_pepper_instances_.begin(); | 3482 for (PepperPluginSet::iterator i = active_pepper_instances_.begin(); |
3490 i != active_pepper_instances_.end(); ++i) | 3483 i != active_pepper_instances_.end(); ++i) |
3491 (*i)->SetContentAreaFocus(enable); | 3484 (*i)->SetContentAreaFocus(enable); |
3492 #endif | 3485 #endif |
3493 // Notify all BrowserPlugins of the RenderView's focus state. | 3486 // Notify all BrowserPlugins of the RenderView's focus state. |
3494 if (browser_plugin_manager_.get()) | 3487 if (BrowserPluginManager::Get()) |
3495 browser_plugin_manager_->UpdateFocusState(); | 3488 BrowserPluginManager::Get()->UpdateFocusState(); |
3496 } | 3489 } |
3497 | 3490 |
3498 void RenderViewImpl::OnImeSetComposition( | 3491 void RenderViewImpl::OnImeSetComposition( |
3499 const base::string16& text, | 3492 const base::string16& text, |
3500 const std::vector<blink::WebCompositionUnderline>& underlines, | 3493 const std::vector<blink::WebCompositionUnderline>& underlines, |
3501 int selection_start, | 3494 int selection_start, |
3502 int selection_end) { | 3495 int selection_end) { |
3503 #if defined(ENABLE_PLUGINS) | 3496 #if defined(ENABLE_PLUGINS) |
3504 if (focused_pepper_plugin_) { | 3497 if (focused_pepper_plugin_) { |
3505 focused_pepper_plugin_->render_frame()->OnImeSetComposition( | 3498 focused_pepper_plugin_->render_frame()->OnImeSetComposition( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3575 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
3583 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3576 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
3584 if (webview()) { | 3577 if (webview()) { |
3585 webview()->setDeviceScaleFactor(device_scale_factor); | 3578 webview()->setDeviceScaleFactor(device_scale_factor); |
3586 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3579 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3587 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3580 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3588 } | 3581 } |
3589 if (auto_resize_mode_) | 3582 if (auto_resize_mode_) |
3590 AutoResizeCompositor(); | 3583 AutoResizeCompositor(); |
3591 | 3584 |
3592 if (browser_plugin_manager_.get()) | 3585 if (BrowserPluginManager::Get()) |
3593 browser_plugin_manager_->UpdateDeviceScaleFactor(); | 3586 BrowserPluginManager::Get()->UpdateDeviceScaleFactor(); |
3594 } | 3587 } |
3595 | 3588 |
3596 bool RenderViewImpl::SetDeviceColorProfile( | 3589 bool RenderViewImpl::SetDeviceColorProfile( |
3597 const std::vector<char>& profile) { | 3590 const std::vector<char>& profile) { |
3598 bool changed = RenderWidget::SetDeviceColorProfile(profile); | 3591 bool changed = RenderWidget::SetDeviceColorProfile(profile); |
3599 if (changed && webview()) { | 3592 if (changed && webview()) { |
3600 WebVector<char> colorProfile = profile; | 3593 WebVector<char> colorProfile = profile; |
3601 webview()->setDeviceColorProfile(colorProfile); | 3594 webview()->setDeviceColorProfile(colorProfile); |
3602 } | 3595 } |
3603 return changed; | 3596 return changed; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( | 4060 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( |
4068 const cc::SharedBitmapId& id) { | 4061 const cc::SharedBitmapId& id) { |
4069 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); | 4062 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); |
4070 DCHECK(it != disambiguation_bitmaps_.end()); | 4063 DCHECK(it != disambiguation_bitmaps_.end()); |
4071 delete it->second; | 4064 delete it->second; |
4072 disambiguation_bitmaps_.erase(it); | 4065 disambiguation_bitmaps_.erase(it); |
4073 } | 4066 } |
4074 | 4067 |
4075 void RenderViewImpl::DidCommitCompositorFrame() { | 4068 void RenderViewImpl::DidCommitCompositorFrame() { |
4076 RenderWidget::DidCommitCompositorFrame(); | 4069 RenderWidget::DidCommitCompositorFrame(); |
| 4070 if (BrowserPluginManager::Get()) |
| 4071 BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); |
4077 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 4072 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
4078 } | 4073 } |
4079 | 4074 |
4080 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { | 4075 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { |
4081 if (!urls.empty()) | 4076 if (!urls.empty()) |
4082 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); | 4077 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); |
4083 } | 4078 } |
4084 | 4079 |
4085 void RenderViewImpl::DidStopLoadingIcons() { | 4080 void RenderViewImpl::DidStopLoadingIcons() { |
4086 int icon_types = WebIconURL::TypeFavicon; | 4081 int icon_types = WebIconURL::TypeFavicon; |
(...skipping 14 matching lines...) Expand all Loading... |
4101 std::vector<gfx::Size> sizes; | 4096 std::vector<gfx::Size> sizes; |
4102 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4097 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4103 if (!url.isEmpty()) | 4098 if (!url.isEmpty()) |
4104 urls.push_back( | 4099 urls.push_back( |
4105 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4100 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4106 } | 4101 } |
4107 SendUpdateFaviconURL(urls); | 4102 SendUpdateFaviconURL(urls); |
4108 } | 4103 } |
4109 | 4104 |
4110 } // namespace content | 4105 } // namespace content |
OLD | NEW |