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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2356 // Copy over the alternate error page URL so we can have alt error pages in | 2356 // Copy over the alternate error page URL so we can have alt error pages in |
2357 // the new render view (we don't need the browser to send the URL back down). | 2357 // the new render view (we don't need the browser to send the URL back down). |
2358 view->alternate_error_page_url_ = alternate_error_page_url_; | 2358 view->alternate_error_page_url_ = alternate_error_page_url_; |
2359 | 2359 |
2360 return view->webview(); | 2360 return view->webview(); |
2361 } | 2361 } |
2362 | 2362 |
2363 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { | 2363 WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) { |
2364 RenderWidget* widget = | 2364 RenderWidget* widget = |
2365 RenderWidget::Create(routing_id_, popup_type, screen_info_); | 2365 RenderWidget::Create(routing_id_, popup_type, screen_info_); |
2366 if (device_emulation_helper_) | |
2367 device_emulation_helper_->PopupCreated(this, widget); | |
2366 return widget->webwidget(); | 2368 return widget->webwidget(); |
2367 } | 2369 } |
2368 | 2370 |
2369 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( | 2371 WebExternalPopupMenu* RenderViewImpl::createExternalPopupMenu( |
2370 const WebPopupMenuInfo& popup_menu_info, | 2372 const WebPopupMenuInfo& popup_menu_info, |
2371 WebExternalPopupMenuClient* popup_menu_client) { | 2373 WebExternalPopupMenuClient* popup_menu_client) { |
2372 // An IPC message is sent to the browser to build and display the actual | 2374 // An IPC message is sent to the browser to build and display the actual |
2373 // popup. The user could have time to click a different select by the time | 2375 // popup. The user could have time to click a different select by the time |
2374 // the popup is shown. In that case external_popup_menu_ is non NULL. | 2376 // the popup is shown. In that case external_popup_menu_ is non NULL. |
2375 // By returning NULL in that case, we instruct WebKit to cancel that new | 2377 // By returning NULL in that case, we instruct WebKit to cancel that new |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2433 routing_id_, | 2435 routing_id_, |
2434 id, | 2436 id, |
2435 base::FilePath::FromUTF16Unsafe(path))); | 2437 base::FilePath::FromUTF16Unsafe(path))); |
2436 } | 2438 } |
2437 | 2439 |
2438 void RenderViewImpl::initializeHelperPluginWebFrame( | 2440 void RenderViewImpl::initializeHelperPluginWebFrame( |
2439 WebKit::WebHelperPlugin* plugin) { | 2441 WebKit::WebHelperPlugin* plugin) { |
2440 plugin->initializeFrame(main_render_frame_.get()); | 2442 plugin->initializeFrame(main_render_frame_.get()); |
2441 } | 2443 } |
2442 | 2444 |
2445 void RenderViewImpl::emulateDevice( | |
2446 bool enabled, | |
2447 const WebKit::WebSize& device_size, | |
2448 const WebKit::WebRect& view_rect, | |
2449 float device_scale_factor, | |
2450 bool fit_to_view) { | |
2451 if (enabled && webview()) { | |
2452 webview()->settings()->setViewportEnabled(true); | |
2453 webview()->enableFixedLayoutMode(true); | |
2454 webview()->settings()->setForceCompositingMode(true); | |
2455 } | |
2456 EmulateDevice(enabled, gfx::Size(device_size), gfx::Rect(view_rect), | |
2457 device_scale_factor, fit_to_view); | |
2458 if (!enabled && webview()) { | |
2459 webview()->settings()->setForceCompositingMode(false); | |
aelias_OOO_until_Jul13
2013/09/05 08:26:49
This one is usually true on desktop as well, this
dgozman
2013/09/10 19:54:02
Nice catch, thanks!
| |
2460 webview()->enableFixedLayoutMode(false); | |
2461 webview()->settings()->setViewportEnabled(false); | |
2462 } | |
2463 } | |
2464 | |
2443 void RenderViewImpl::didStartLoading() { | 2465 void RenderViewImpl::didStartLoading() { |
2444 if (is_loading_) { | 2466 if (is_loading_) { |
2445 DVLOG(1) << "didStartLoading called while loading"; | 2467 DVLOG(1) << "didStartLoading called while loading"; |
2446 return; | 2468 return; |
2447 } | 2469 } |
2448 | 2470 |
2449 is_loading_ = true; | 2471 is_loading_ = true; |
2450 | 2472 |
2451 Send(new ViewHostMsg_DidStartLoading(routing_id_)); | 2473 Send(new ViewHostMsg_DidStartLoading(routing_id_)); |
2452 | 2474 |
(...skipping 4103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6556 WebURL url = icon_urls[i].iconURL(); | 6578 WebURL url = icon_urls[i].iconURL(); |
6557 if (!url.isEmpty()) | 6579 if (!url.isEmpty()) |
6558 urls.push_back(FaviconURL(url, | 6580 urls.push_back(FaviconURL(url, |
6559 ToFaviconType(icon_urls[i].iconType()))); | 6581 ToFaviconType(icon_urls[i].iconType()))); |
6560 } | 6582 } |
6561 SendUpdateFaviconURL(urls); | 6583 SendUpdateFaviconURL(urls); |
6562 } | 6584 } |
6563 | 6585 |
6564 | 6586 |
6565 } // namespace content | 6587 } // namespace content |
OLD | NEW |