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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, | 630 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint, |
631 OnFirstVisuallyNonEmptyPaint) | 631 OnFirstVisuallyNonEmptyPaint) |
632 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, | 632 IPC_MESSAGE_HANDLER(FrameHostMsg_DidLoadResourceFromMemoryCache, |
633 OnDidLoadResourceFromMemoryCache) | 633 OnDidLoadResourceFromMemoryCache) |
634 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, | 634 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisplayInsecureContent, |
635 OnDidDisplayInsecureContent) | 635 OnDidDisplayInsecureContent) |
636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, | 636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, |
637 OnDidRunInsecureContent) | 637 OnDidRunInsecureContent) |
638 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 638 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
639 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 639 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 640 IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged, |
| 641 OnPageScaleFactorChanged) |
640 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 642 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
641 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, | 643 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, |
642 OnRegisterProtocolHandler) | 644 OnRegisterProtocolHandler) |
643 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, | 645 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, |
644 OnUnregisterProtocolHandler) | 646 OnUnregisterProtocolHandler) |
645 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, | 647 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, |
646 OnUpdatePageImportanceSignals) | 648 OnUpdatePageImportanceSignals) |
647 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 649 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
648 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 650 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
649 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 651 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2615 } | 2617 } |
2616 | 2618 |
2617 int WebContentsImpl::GetMinimumZoomPercent() const { | 2619 int WebContentsImpl::GetMinimumZoomPercent() const { |
2618 return minimum_zoom_percent_; | 2620 return minimum_zoom_percent_; |
2619 } | 2621 } |
2620 | 2622 |
2621 int WebContentsImpl::GetMaximumZoomPercent() const { | 2623 int WebContentsImpl::GetMaximumZoomPercent() const { |
2622 return maximum_zoom_percent_; | 2624 return maximum_zoom_percent_; |
2623 } | 2625 } |
2624 | 2626 |
| 2627 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
| 2628 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); |
| 2629 } |
| 2630 |
2625 void WebContentsImpl::ResetPageScale() { | 2631 void WebContentsImpl::ResetPageScale() { |
2626 Send(new ViewMsg_ResetPageScale(GetRoutingID())); | 2632 Send(new ViewMsg_ResetPageScale(GetRoutingID())); |
2627 } | 2633 } |
2628 | 2634 |
2629 gfx::Size WebContentsImpl::GetPreferredSize() const { | 2635 gfx::Size WebContentsImpl::GetPreferredSize() const { |
2630 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 2636 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
2631 } | 2637 } |
2632 | 2638 |
2633 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 2639 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
2634 if (GetBrowserPluginGuest()) | 2640 if (GetBrowserPluginGuest()) |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3113 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) | 3119 if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) |
3114 controller_.GoToOffset(offset); | 3120 controller_.GoToOffset(offset); |
3115 } | 3121 } |
3116 | 3122 |
3117 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, | 3123 void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, |
3118 int maximum_percent) { | 3124 int maximum_percent) { |
3119 minimum_zoom_percent_ = minimum_percent; | 3125 minimum_zoom_percent_ = minimum_percent; |
3120 maximum_zoom_percent_ = maximum_percent; | 3126 maximum_zoom_percent_ = maximum_percent; |
3121 } | 3127 } |
3122 | 3128 |
| 3129 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { |
| 3130 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3131 observers_, |
| 3132 OnPageScaleFactorChanged(page_scale_factor)); |
| 3133 } |
| 3134 |
3123 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3135 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
3124 const base::FilePath& path) { | 3136 const base::FilePath& path) { |
3125 if (!delegate_) | 3137 if (!delegate_) |
3126 return; | 3138 return; |
3127 | 3139 |
3128 ChildProcessSecurityPolicyImpl* policy = | 3140 ChildProcessSecurityPolicyImpl* policy = |
3129 ChildProcessSecurityPolicyImpl::GetInstance(); | 3141 ChildProcessSecurityPolicyImpl::GetInstance(); |
3130 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) | 3142 if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) |
3131 delegate_->EnumerateDirectory(this, request_id, path); | 3143 delegate_->EnumerateDirectory(this, request_id, path); |
3132 } | 3144 } |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4643 return NULL; | 4655 return NULL; |
4644 } | 4656 } |
4645 | 4657 |
4646 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4658 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4647 force_disable_overscroll_content_ = force_disable; | 4659 force_disable_overscroll_content_ = force_disable; |
4648 if (view_) | 4660 if (view_) |
4649 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4661 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4650 } | 4662 } |
4651 | 4663 |
4652 } // namespace content | 4664 } // namespace content |
OLD | NEW |