Chromium Code Reviews| 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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 size.set_height(static_cast<int>(size.height() * zoom_factor)); | 2369 size.set_height(static_cast<int>(size.height() * zoom_factor)); |
| 2371 | 2370 |
| 2372 if (size == preferred_size_) | 2371 if (size == preferred_size_) |
| 2373 return; | 2372 return; |
| 2374 | 2373 |
| 2375 preferred_size_ = size; | 2374 preferred_size_ = size; |
| 2376 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 2375 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
| 2377 preferred_size_)); | 2376 preferred_size_)); |
| 2378 } | 2377 } |
| 2379 | 2378 |
| 2380 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { | |
| 2381 if (!browser_plugin_manager_.get()) | |
| 2382 browser_plugin_manager_ = BrowserPluginManager::Create(this); | |
| 2383 return browser_plugin_manager_.get(); | |
| 2384 } | |
| 2385 | |
| 2386 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { | 2379 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
| 2387 StartNavStateSyncTimerIfNecessary(); | 2380 StartNavStateSyncTimerIfNecessary(); |
| 2388 | 2381 |
| 2389 FOR_EACH_OBSERVER( | 2382 FOR_EACH_OBSERVER( |
| 2390 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); | 2383 RenderViewObserver, observers_, DidChangeScrollOffset(frame)); |
| 2391 } | 2384 } |
| 2392 | 2385 |
| 2393 void RenderViewImpl::SendFindReply(int request_id, | 2386 void RenderViewImpl::SendFindReply(int request_id, |
| 2394 int match_count, | 2387 int match_count, |
| 2395 int ordinal, | 2388 int ordinal, |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3490 #endif | 3483 #endif |
| 3491 (*plugin_it)->SetContentAreaFocus(enable); | 3484 (*plugin_it)->SetContentAreaFocus(enable); |
| 3492 } | 3485 } |
| 3493 } | 3486 } |
| 3494 // Notify all Pepper plugins. | 3487 // Notify all Pepper plugins. |
| 3495 for (PepperPluginSet::iterator i = active_pepper_instances_.begin(); | 3488 for (PepperPluginSet::iterator i = active_pepper_instances_.begin(); |
| 3496 i != active_pepper_instances_.end(); ++i) | 3489 i != active_pepper_instances_.end(); ++i) |
| 3497 (*i)->SetContentAreaFocus(enable); | 3490 (*i)->SetContentAreaFocus(enable); |
| 3498 #endif | 3491 #endif |
| 3499 // Notify all BrowserPlugins of the RenderView's focus state. | 3492 // Notify all BrowserPlugins of the RenderView's focus state. |
| 3500 if (browser_plugin_manager_.get()) | 3493 BrowserPluginManager::Get()->UpdateFocusState(); |
| 3501 browser_plugin_manager_->UpdateFocusState(); | |
| 3502 } | 3494 } |
| 3503 | 3495 |
| 3504 void RenderViewImpl::OnImeSetComposition( | 3496 void RenderViewImpl::OnImeSetComposition( |
| 3505 const base::string16& text, | 3497 const base::string16& text, |
| 3506 const std::vector<blink::WebCompositionUnderline>& underlines, | 3498 const std::vector<blink::WebCompositionUnderline>& underlines, |
| 3507 int selection_start, | 3499 int selection_start, |
| 3508 int selection_end) { | 3500 int selection_end) { |
| 3509 #if defined(ENABLE_PLUGINS) | 3501 #if defined(ENABLE_PLUGINS) |
| 3510 if (focused_pepper_plugin_) { | 3502 if (focused_pepper_plugin_) { |
| 3511 focused_pepper_plugin_->render_frame()->OnImeSetComposition( | 3503 focused_pepper_plugin_->render_frame()->OnImeSetComposition( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3588 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3580 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 3589 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3581 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 3590 if (webview()) { | 3582 if (webview()) { |
| 3591 webview()->setDeviceScaleFactor(device_scale_factor); | 3583 webview()->setDeviceScaleFactor(device_scale_factor); |
| 3592 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3584 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3593 PreferCompositingToLCDText(device_scale_factor_)); | 3585 PreferCompositingToLCDText(device_scale_factor_)); |
| 3594 } | 3586 } |
| 3595 if (auto_resize_mode_) | 3587 if (auto_resize_mode_) |
| 3596 AutoResizeCompositor(); | 3588 AutoResizeCompositor(); |
| 3597 | 3589 |
| 3598 if (browser_plugin_manager_.get()) | 3590 BrowserPluginManager::Get()->UpdateDeviceScaleFactor(); |
| 3599 browser_plugin_manager_->UpdateDeviceScaleFactor(); | |
| 3600 } | 3591 } |
| 3601 | 3592 |
| 3602 bool RenderViewImpl::SetDeviceColorProfile( | 3593 bool RenderViewImpl::SetDeviceColorProfile( |
| 3603 const std::vector<char>& profile) { | 3594 const std::vector<char>& profile) { |
| 3604 bool changed = RenderWidget::SetDeviceColorProfile(profile); | 3595 bool changed = RenderWidget::SetDeviceColorProfile(profile); |
| 3605 if (changed && webview()) { | 3596 if (changed && webview()) { |
| 3606 WebVector<char> colorProfile = profile; | 3597 WebVector<char> colorProfile = profile; |
| 3607 webview()->setDeviceColorProfile(colorProfile); | 3598 webview()->setDeviceColorProfile(colorProfile); |
| 3608 } | 3599 } |
| 3609 return changed; | 3600 return changed; |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4073 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( | 4064 void RenderViewImpl::OnReleaseDisambiguationPopupBitmap( |
| 4074 const cc::SharedBitmapId& id) { | 4065 const cc::SharedBitmapId& id) { |
| 4075 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); | 4066 BitmapMap::iterator it = disambiguation_bitmaps_.find(id); |
| 4076 DCHECK(it != disambiguation_bitmaps_.end()); | 4067 DCHECK(it != disambiguation_bitmaps_.end()); |
| 4077 delete it->second; | 4068 delete it->second; |
| 4078 disambiguation_bitmaps_.erase(it); | 4069 disambiguation_bitmaps_.erase(it); |
| 4079 } | 4070 } |
| 4080 | 4071 |
| 4081 void RenderViewImpl::DidCommitCompositorFrame() { | 4072 void RenderViewImpl::DidCommitCompositorFrame() { |
| 4082 RenderWidget::DidCommitCompositorFrame(); | 4073 RenderWidget::DidCommitCompositorFrame(); |
| 4074 BrowserPluginManager::Get()->DidCommitCompositorFrame(); | |
|
lazyboy
2014/12/16 23:57:30
I'm not sure about this one, if you have two <webv
Fady Samuel
2014/12/17 19:30:35
Passing in the routing ID.
| |
| 4083 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 4075 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
| 4084 } | 4076 } |
| 4085 | 4077 |
| 4086 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { | 4078 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { |
| 4087 if (!urls.empty()) | 4079 if (!urls.empty()) |
| 4088 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); | 4080 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); |
| 4089 } | 4081 } |
| 4090 | 4082 |
| 4091 void RenderViewImpl::DidStopLoadingIcons() { | 4083 void RenderViewImpl::DidStopLoadingIcons() { |
| 4092 int icon_types = WebIconURL::TypeFavicon; | 4084 int icon_types = WebIconURL::TypeFavicon; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 4107 std::vector<gfx::Size> sizes; | 4099 std::vector<gfx::Size> sizes; |
| 4108 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4100 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4109 if (!url.isEmpty()) | 4101 if (!url.isEmpty()) |
| 4110 urls.push_back( | 4102 urls.push_back( |
| 4111 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4103 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4112 } | 4104 } |
| 4113 SendUpdateFaviconURL(urls); | 4105 SendUpdateFaviconURL(urls); |
| 4114 } | 4106 } |
| 4115 | 4107 |
| 4116 } // namespace content | 4108 } // namespace content |
| OLD | NEW |