OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 | 266 |
267 WebColor color_; | 267 WebColor color_; |
268 }; | 268 }; |
269 | 269 |
270 } // namespace | 270 } // namespace |
271 | 271 |
272 // WebView ---------------------------------------------------------------- | 272 // WebView ---------------------------------------------------------------- |
273 | 273 |
274 WebView* WebView::Create(WebViewClient* client, | 274 WebView* WebView::Create(WebViewClient* client, |
275 WebPageVisibilityState visibility_state) { | 275 WebPageVisibilityState visibility_state) { |
276 // Pass the WebViewImpl's self-reference to the caller. | 276 return WebViewBase::Create(client, visibility_state); |
277 } | |
278 | |
279 WebViewBase* WebViewBase::Create(WebViewClient* client, | |
280 WebPageVisibilityState visibility_state) { | |
277 return WebViewImpl::Create(client, visibility_state); | 281 return WebViewImpl::Create(client, visibility_state); |
278 } | 282 } |
279 | 283 |
280 WebViewImpl* WebViewImpl::Create(WebViewClient* client, | 284 WebViewBase* WebViewImpl::Create(WebViewClient* client, |
281 WebPageVisibilityState visibility_state) { | 285 WebPageVisibilityState visibility_state) { |
282 // Pass the WebViewImpl's self-reference to the caller. | 286 // Pass the WebViewImpl's self-reference to the caller. |
283 return AdoptRef(new WebViewImpl(client, visibility_state)).LeakRef(); | 287 return AdoptRef(new WebViewImpl(client, visibility_state)).LeakRef(); |
284 } | 288 } |
285 | 289 |
286 const WebInputEvent* WebViewBase::CurrentInputEvent() { | 290 const WebInputEvent* WebViewBase::CurrentInputEvent() { |
287 return WebViewImpl::CurrentInputEvent(); | 291 return WebViewImpl::CurrentInputEvent(); |
288 } | 292 } |
289 | 293 |
290 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { | 294 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 } | 1771 } |
1768 | 1772 |
1769 Frame* WebViewImpl::FocusedCoreFrame() const { | 1773 Frame* WebViewImpl::FocusedCoreFrame() const { |
1770 return page_ ? page_->GetFocusController().FocusedOrMainFrame() : nullptr; | 1774 return page_ ? page_->GetFocusController().FocusedOrMainFrame() : nullptr; |
1771 } | 1775 } |
1772 | 1776 |
1773 WebViewBase* WebViewBase::FromPage(Page* page) { | 1777 WebViewBase* WebViewBase::FromPage(Page* page) { |
1774 return WebViewImpl::FromPage(page); | 1778 return WebViewImpl::FromPage(page); |
1775 } | 1779 } |
1776 | 1780 |
1777 WebViewImpl* WebViewImpl::FromPage(Page* page) { | 1781 WebViewBase* WebViewImpl::FromPage(Page* page) { |
1778 return page ? static_cast<WebViewImpl*>(page->GetChromeClient().WebView()) | 1782 return page ? static_cast<WebViewBase*>(page->GetChromeClient().WebView()) |
1779 : nullptr; | 1783 : nullptr; |
1780 } | 1784 } |
1781 | 1785 |
1782 // WebWidget ------------------------------------------------------------------ | 1786 // WebWidget ------------------------------------------------------------------ |
1783 | 1787 |
1784 void WebViewImpl::Close() { | 1788 void WebViewImpl::Close() { |
1785 DCHECK(AllInstances().Contains(this)); | 1789 DCHECK(AllInstances().Contains(this)); |
1786 AllInstances().erase(this); | 1790 AllInstances().erase(this); |
1787 | 1791 |
1788 if (page_) { | 1792 if (page_) { |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2153 | 2157 |
2154 bool WebViewImpl::HasVerticalScrollbar() { | 2158 bool WebViewImpl::HasVerticalScrollbar() { |
2155 return MainFrameImpl() | 2159 return MainFrameImpl() |
2156 ->GetFrameView() | 2160 ->GetFrameView() |
2157 ->LayoutViewportScrollableArea() | 2161 ->LayoutViewportScrollableArea() |
2158 ->VerticalScrollbar(); | 2162 ->VerticalScrollbar(); |
2159 } | 2163 } |
2160 | 2164 |
2161 const WebInputEvent* WebViewImpl::current_input_event_ = nullptr; | 2165 const WebInputEvent* WebViewImpl::current_input_event_ = nullptr; |
2162 | 2166 |
2167 void WebViewBase::SetCurrentInputEventForTest(const WebInputEvent* event) { | |
haraken
2017/05/04 05:30:42
It looks a bit strange that WebViewBase's method i
slangley
2017/05/04 09:15:34
This is the same as WebView::Create(), the other o
haraken
2017/05/04 15:14:31
Can we make current_input_event_ a non-static memb
| |
2168 WebViewImpl::SetCurrentInputEventForTest(event); | |
2169 } | |
2170 | |
2163 WebInputEventResult WebViewImpl::HandleInputEvent( | 2171 WebInputEventResult WebViewImpl::HandleInputEvent( |
2164 const WebCoalescedInputEvent& coalesced_event) { | 2172 const WebCoalescedInputEvent& coalesced_event) { |
2165 const WebInputEvent& input_event = coalesced_event.Event(); | 2173 const WebInputEvent& input_event = coalesced_event.Event(); |
2166 // TODO(dcheng): The fact that this is getting called when there is no local | 2174 // TODO(dcheng): The fact that this is getting called when there is no local |
2167 // main frame is problematic and probably indicates a bug in the input event | 2175 // main frame is problematic and probably indicates a bug in the input event |
2168 // routing code. | 2176 // routing code. |
2169 if (!MainFrameImpl()) | 2177 if (!MainFrameImpl()) |
2170 return WebInputEventResult::kNotHandled; | 2178 return WebInputEventResult::kNotHandled; |
2171 | 2179 |
2172 GetPage()->GetVisualViewport().StartTrackingPinchStats(); | 2180 GetPage()->GetVisualViewport().StartTrackingPinchStats(); |
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4180 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4188 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
4181 return nullptr; | 4189 return nullptr; |
4182 return focused_frame; | 4190 return focused_frame; |
4183 } | 4191 } |
4184 | 4192 |
4185 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4193 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
4186 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4194 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
4187 } | 4195 } |
4188 | 4196 |
4189 } // namespace blink | 4197 } // namespace blink |
OLD | NEW |