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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 406 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
407 fullscreen_widget_had_focus_at_shutdown_(false), | 407 fullscreen_widget_had_focus_at_shutdown_(false), |
408 is_subframe_(false), | 408 is_subframe_(false), |
409 force_disable_overscroll_content_(false), | 409 force_disable_overscroll_content_(false), |
410 last_dialog_suppressed_(false), | 410 last_dialog_suppressed_(false), |
411 geolocation_service_context_(new GeolocationServiceContext()), | 411 geolocation_service_context_(new GeolocationServiceContext()), |
412 accessibility_mode_( | 412 accessibility_mode_( |
413 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 413 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
414 audio_stream_monitor_(this), | 414 audio_stream_monitor_(this), |
415 virtual_keyboard_requested_(false), | 415 virtual_keyboard_requested_(false), |
416 page_scale_factor_is_one_(true), | |
416 loading_weak_factory_(this) { | 417 loading_weak_factory_(this) { |
417 frame_tree_.SetFrameRemoveListener( | 418 frame_tree_.SetFrameRemoveListener( |
418 base::Bind(&WebContentsImpl::OnFrameRemoved, | 419 base::Bind(&WebContentsImpl::OnFrameRemoved, |
419 base::Unretained(this))); | 420 base::Unretained(this))); |
420 #if defined(ENABLE_BROWSER_CDMS) | 421 #if defined(ENABLE_BROWSER_CDMS) |
421 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 422 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
422 #endif | 423 #endif |
423 } | 424 } |
424 | 425 |
425 WebContentsImpl::~WebContentsImpl() { | 426 WebContentsImpl::~WebContentsImpl() { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, | 631 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, |
631 OnFirstVisuallyNonEmptyPaint) | 632 OnFirstVisuallyNonEmptyPaint) |
632 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, | 633 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, |
633 OnDidLoadResourceFromMemoryCache) | 634 OnDidLoadResourceFromMemoryCache) |
634 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, | 635 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, |
635 OnDidDisplayInsecureContent) | 636 OnDidDisplayInsecureContent) |
636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, | 637 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, |
637 OnDidRunInsecureContent) | 638 OnDidRunInsecureContent) |
638 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 639 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
639 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 640 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
641 IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged, | |
642 OnPageScaleFactorChanged) | |
640 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 643 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
641 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, | 644 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, |
642 OnRegisterProtocolHandler) | 645 OnRegisterProtocolHandler) |
643 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, | 646 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, |
644 OnUnregisterProtocolHandler) | 647 OnUnregisterProtocolHandler) |
645 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, | 648 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, |
646 OnUpdatePageImportanceSignals) | 649 OnUpdatePageImportanceSignals) |
647 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 650 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
648 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 651 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
649 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 652 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2611 } | 2614 } |
2612 | 2615 |
2613 int WebContentsImpl::GetMinimumZoomPercent() const { | 2616 int WebContentsImpl::GetMinimumZoomPercent() const { |
2614 return minimum_zoom_percent_; | 2617 return minimum_zoom_percent_; |
2615 } | 2618 } |
2616 | 2619 |
2617 int WebContentsImpl::GetMaximumZoomPercent() const { | 2620 int WebContentsImpl::GetMaximumZoomPercent() const { |
2618 return maximum_zoom_percent_; | 2621 return maximum_zoom_percent_; |
2619 } | 2622 } |
2620 | 2623 |
2621 void WebContentsImpl::ResetPageScale() { | 2624 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
2622 Send(new ViewMsg_ResetPageScale(GetRoutingID())); | 2625 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); |
2623 } | 2626 } |
2624 | 2627 |
2625 gfx::Size WebContentsImpl::GetPreferredSize() const { | 2628 gfx::Size WebContentsImpl::GetPreferredSize() const { |
2626 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 2629 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
2627 } | 2630 } |
2628 | 2631 |
2629 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2632 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2630 if (GetBrowserPluginGuest()) | 2633 if (GetBrowserPluginGuest()) |
2631 return GetBrowserPluginGuest()->LockMouse(allowed); | 2634 return GetBrowserPluginGuest()->LockMouse(allowed); |
2632 | 2635 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3110 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) | 3113 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) |
3111 controller_.GoToOffset(offset); | 3114 controller_.GoToOffset(offset); |
3112 } | 3115 } |
3113 | 3116 |
3114 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, | 3117 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, |
3115 int maximum_percent) { | 3118 int maximum_percent) { |
3116 minimum_zoom_percent_ = minimum_percent; | 3119 minimum_zoom_percent_ = minimum_percent; |
3117 maximum_zoom_percent_ = maximum_percent; | 3120 maximum_zoom_percent_ = maximum_percent; |
3118 } | 3121 } |
3119 | 3122 |
3123 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { | |
3124 bool is_one = page_scale_factor == 1.f; | |
3125 if (is_one != page_scale_factor_is_one_) { | |
3126 page_scale_factor_is_one_ = is_one; | |
3127 | |
3128 if (GetSiteInstance()) { | |
3129 HostZoomMapImpl* host_zoom_map = | |
3130 static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); | |
Charlie Reis
2015/10/21 21:37:09
I'm concerned about this, because there isn't a si
wjmaclean
2015/10/22 15:03:14
I would like to suggest that we do land this chang
Fady Samuel
2015/10/22 15:09:01
I'm not sure this needs changing for OOPIFs.
Zoom
Charlie Reis
2015/10/22 19:09:25
Sure.
Kevin McNee - google account
2015/10/22 20:28:48
Done.
| |
3131 | |
3132 if (host_zoom_map && GetRenderProcessHost()) { | |
3133 host_zoom_map->SetPageScaleFactorIsOneForView( | |
3134 GetRenderProcessHost()->GetID(), GetRoutingID(), | |
3135 page_scale_factor_is_one_); | |
3136 } | |
3137 } | |
3138 } | |
3139 | |
3140 FOR_EACH_OBSERVER(WebContentsObserver, | |
3141 observers_, | |
3142 OnPageScaleFactorChanged(page_scale_factor)); | |
3143 } | |
3144 | |
3120 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3145 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
3121 const base::FilePath& path) { | 3146 const base::FilePath& path) { |
3122 if (!delegate_) | 3147 if (!delegate_) |
3123 return; | 3148 return; |
3124 | 3149 |
3125 ChildProcessSecurityPolicyImpl* policy = | 3150 ChildProcessSecurityPolicyImpl* policy = |
3126 ChildProcessSecurityPolicyImpl::GetInstance(); | 3151 ChildProcessSecurityPolicyImpl::GetInstance(); |
3127 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) | 3152 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) |
3128 delegate_->EnumerateDirectory(this, request_id, path); | 3153 delegate_->EnumerateDirectory(this, request_id, path); |
3129 } | 3154 } |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4640 return NULL; | 4665 return NULL; |
4641 } | 4666 } |
4642 | 4667 |
4643 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4668 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4644 force_disable_overscroll_content_ = force_disable; | 4669 force_disable_overscroll_content_ = force_disable; |
4645 if (view_) | 4670 if (view_) |
4646 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4671 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4647 } | 4672 } |
4648 | 4673 |
4649 } // namespace content | 4674 } // namespace content |
OLD | NEW |