Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2738133002: Provide an overload to WebView::create that does not require a WebViewClient. (Closed)
Patch Set: Add a derived WebViewClient and use it when no client is passed. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return; 264 return;
265 FloatRect rect(0, 0, size.width, size.height); 265 FloatRect rect(0, 0, size.width, size.height);
266 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay, 266 DrawingRecorder drawingRecorder(graphicsContext, pageOverlay,
267 DisplayItem::kPageOverlay, rect); 267 DisplayItem::kPageOverlay, rect);
268 graphicsContext.fillRect(rect, m_color); 268 graphicsContext.fillRect(rect, m_color);
269 } 269 }
270 270
271 WebColor m_color; 271 WebColor m_color;
272 }; 272 };
273 273
274 class DetachedWebViewClient : public WebViewClient {
275 public:
276 virtual ~DetachedWebViewClient() {}
277 };
278
274 } // namespace 279 } // namespace
275 280
276 // WebView ---------------------------------------------------------------- 281 // WebView ----------------------------------------------------------------
277 282
283 WebView* WebView::create(WebPageVisibilityState visibilityState) {
284 return WebViewImpl::create(visibilityState);
285 }
286
278 WebView* WebView::create(WebViewClient* client, 287 WebView* WebView::create(WebViewClient* client,
279 WebPageVisibilityState visibilityState) { 288 WebPageVisibilityState visibilityState) {
289 DCHECK(client) << "A valid WebViewClient must be supplied.";
280 // Pass the WebViewImpl's self-reference to the caller. 290 // Pass the WebViewImpl's self-reference to the caller.
281 return WebViewImpl::create(client, visibilityState); 291 return WebViewImpl::create(client, visibilityState);
282 } 292 }
283 293
294 WebViewImpl* WebViewImpl::create(WebPageVisibilityState visibilityState) {
295 DEFINE_STATIC_LOCAL(DetachedWebViewClient, detachedWebViewClient, ());
296 return adoptRef(new WebViewImpl(&detachedWebViewClient, visibilityState))
297 .leakRef();
298 }
299
284 WebViewImpl* WebViewImpl::create(WebViewClient* client, 300 WebViewImpl* WebViewImpl::create(WebViewClient* client,
285 WebPageVisibilityState visibilityState) { 301 WebPageVisibilityState visibilityState) {
302 DCHECK(client) << "A valid WebViewClient must be supplied.";
286 // Pass the WebViewImpl's self-reference to the caller. 303 // Pass the WebViewImpl's self-reference to the caller.
287 return adoptRef(new WebViewImpl(client, visibilityState)).leakRef(); 304 return adoptRef(new WebViewImpl(client, visibilityState)).leakRef();
288 } 305 }
289 306
290 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) { 307 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) {
291 shouldUseExternalPopupMenus = useExternalPopupMenus; 308 shouldUseExternalPopupMenus = useExternalPopupMenus;
292 } 309 }
293 310
294 void WebView::updateVisitedLinkState(unsigned long long linkHash) { 311 void WebView::updateVisitedLinkState(unsigned long long linkHash) {
295 Page::visitedStateChanged(linkHash); 312 Page::visitedStateChanged(linkHash);
(...skipping 3884 matching lines...) Expand 10 before | Expand all | Expand 10 after
4180 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4197 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4181 return nullptr; 4198 return nullptr;
4182 return focusedFrame; 4199 return focusedFrame;
4183 } 4200 }
4184 4201
4185 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4202 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4186 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4203 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4187 } 4204 }
4188 4205
4189 } // namespace blink 4206 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698