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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), | 408 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
409 fullscreen_widget_had_focus_at_shutdown_(false), | 409 fullscreen_widget_had_focus_at_shutdown_(false), |
410 is_subframe_(false), | 410 is_subframe_(false), |
411 force_disable_overscroll_content_(false), | 411 force_disable_overscroll_content_(false), |
412 last_dialog_suppressed_(false), | 412 last_dialog_suppressed_(false), |
413 geolocation_service_context_(new GeolocationServiceContext()), | 413 geolocation_service_context_(new GeolocationServiceContext()), |
414 accessibility_mode_( | 414 accessibility_mode_( |
415 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 415 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
416 audio_stream_monitor_(this), | 416 audio_stream_monitor_(this), |
417 virtual_keyboard_requested_(false), | 417 virtual_keyboard_requested_(false), |
418 page_scale_factor_is_one_(true), | |
418 loading_weak_factory_(this) { | 419 loading_weak_factory_(this) { |
419 frame_tree_.SetFrameRemoveListener( | 420 frame_tree_.SetFrameRemoveListener( |
420 base::Bind(&WebContentsImpl::OnFrameRemoved, | 421 base::Bind(&WebContentsImpl::OnFrameRemoved, |
421 base::Unretained(this))); | 422 base::Unretained(this))); |
422 #if defined(ENABLE_BROWSER_CDMS) | 423 #if defined(ENABLE_BROWSER_CDMS) |
423 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 424 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
424 #endif | 425 #endif |
425 | 426 |
426 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); | 427 wake_lock_service_context_.reset(new WakeLockServiceContext(this)); |
427 } | 428 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, | 632 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, |
632 OnFirstVisuallyNonEmptyPaint) | 633 OnFirstVisuallyNonEmptyPaint) |
633 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, | 634 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, |
634 OnDidLoadResourceFromMemoryCache) | 635 OnDidLoadResourceFromMemoryCache) |
635 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, | 636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, |
636 OnDidDisplayInsecureContent) | 637 OnDidDisplayInsecureContent) |
637 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, | 638 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, |
638 OnDidRunInsecureContent) | 639 OnDidRunInsecureContent) |
639 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 640 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
640 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 641 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
642 IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged, | |
643 OnPageScaleFactorChanged) | |
641 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 644 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
642 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, | 645 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, |
643 OnRegisterProtocolHandler) | 646 OnRegisterProtocolHandler) |
644 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, | 647 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, |
645 OnUnregisterProtocolHandler) | 648 OnUnregisterProtocolHandler) |
646 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, | 649 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, |
647 OnUpdatePageImportanceSignals) | 650 OnUpdatePageImportanceSignals) |
648 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 651 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
649 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 652 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
650 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 653 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2645 } | 2648 } |
2646 | 2649 |
2647 int WebContentsImpl::GetMinimumZoomPercent() const { | 2650 int WebContentsImpl::GetMinimumZoomPercent() const { |
2648 return minimum_zoom_percent_; | 2651 return minimum_zoom_percent_; |
2649 } | 2652 } |
2650 | 2653 |
2651 int WebContentsImpl::GetMaximumZoomPercent() const { | 2654 int WebContentsImpl::GetMaximumZoomPercent() const { |
2652 return maximum_zoom_percent_; | 2655 return maximum_zoom_percent_; |
2653 } | 2656 } |
2654 | 2657 |
2655 void WebContentsImpl::ResetPageScale() { | 2658 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
2656 Send(new ViewMsg_ResetPageScale(GetRoutingID())); | 2659 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); |
2657 } | 2660 } |
2658 | 2661 |
2659 gfx::Size WebContentsImpl::GetPreferredSize() const { | 2662 gfx::Size WebContentsImpl::GetPreferredSize() const { |
2660 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 2663 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
2661 } | 2664 } |
2662 | 2665 |
2663 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2666 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2664 if (GetBrowserPluginGuest()) | 2667 if (GetBrowserPluginGuest()) |
2665 return GetBrowserPluginGuest()->LockMouse(allowed); | 2668 return GetBrowserPluginGuest()->LockMouse(allowed); |
2666 | 2669 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3144 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) | 3147 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) |
3145 controller_.GoToOffset(offset); | 3148 controller_.GoToOffset(offset); |
3146 } | 3149 } |
3147 | 3150 |
3148 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, | 3151 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, |
3149 int maximum_percent) { | 3152 int maximum_percent) { |
3150 minimum_zoom_percent_ = minimum_percent; | 3153 minimum_zoom_percent_ = minimum_percent; |
3151 maximum_zoom_percent_ = maximum_percent; | 3154 maximum_zoom_percent_ = maximum_percent; |
3152 } | 3155 } |
3153 | 3156 |
3157 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { | |
wjmaclean
2015/11/18 16:37:37
is page_scale_factor always guaranteed to be diffe
Kevin McNee - google account
2015/11/18 19:41:34
We only get notifications when the page scale fact
| |
3158 bool is_one = page_scale_factor == 1.f; | |
3159 if (is_one != page_scale_factor_is_one_) { | |
3160 page_scale_factor_is_one_ = is_one; | |
3161 | |
3162 HostZoomMapImpl* host_zoom_map = | |
3163 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); | |
3164 | |
3165 if (host_zoom_map && GetRenderProcessHost()) { | |
3166 host_zoom_map->SetPageScaleFactorIsOneForView( | |
3167 GetRenderProcessHost()->GetID(), GetRoutingID(), | |
3168 page_scale_factor_is_one_); | |
3169 } | |
3170 } | |
3171 | |
3172 FOR_EACH_OBSERVER(WebContentsObserver, | |
3173 observers_, | |
3174 OnPageScaleFactorChanged(page_scale_factor)); | |
3175 } | |
3176 | |
3154 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3177 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
3155 const base::FilePath& path) { | 3178 const base::FilePath& path) { |
3156 if (!delegate_) | 3179 if (!delegate_) |
3157 return; | 3180 return; |
3158 | 3181 |
3159 ChildProcessSecurityPolicyImpl* policy = | 3182 ChildProcessSecurityPolicyImpl* policy = |
3160 ChildProcessSecurityPolicyImpl::GetInstance(); | 3183 ChildProcessSecurityPolicyImpl::GetInstance(); |
3161 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) | 3184 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) |
3162 delegate_->EnumerateDirectory(this, request_id, path); | 3185 delegate_->EnumerateDirectory(this, request_id, path); |
3163 } | 3186 } |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4679 return NULL; | 4702 return NULL; |
4680 } | 4703 } |
4681 | 4704 |
4682 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4705 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4683 force_disable_overscroll_content_ = force_disable; | 4706 force_disable_overscroll_content_ = force_disable; |
4684 if (view_) | 4707 if (view_) |
4685 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4708 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4686 } | 4709 } |
4687 | 4710 |
4688 } // namespace content | 4711 } // namespace content |
OLD | NEW |