| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 result.setFilesystemId(drop_data.filesystem_id); | 635 result.setFilesystemId(drop_data.filesystem_id); |
| 636 return result; | 636 return result; |
| 637 } | 637 } |
| 638 | 638 |
| 639 } // namespace | 639 } // namespace |
| 640 | 640 |
| 641 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) | 641 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) |
| 642 : RenderWidget(blink::WebPopupTypeNone, | 642 : RenderWidget(blink::WebPopupTypeNone, |
| 643 params->screen_info, | 643 params->screen_info, |
| 644 params->swapped_out, | 644 params->swapped_out, |
| 645 params->hidden), | 645 params->hidden, |
| 646 params->never_visible), |
| 646 webkit_preferences_(params->webkit_prefs), | 647 webkit_preferences_(params->webkit_prefs), |
| 647 send_content_state_immediately_(false), | 648 send_content_state_immediately_(false), |
| 648 enabled_bindings_(0), | 649 enabled_bindings_(0), |
| 649 send_preferred_size_changes_(false), | 650 send_preferred_size_changes_(false), |
| 650 navigation_gesture_(NavigationGestureUnknown), | 651 navigation_gesture_(NavigationGestureUnknown), |
| 651 opened_by_user_gesture_(true), | 652 opened_by_user_gesture_(true), |
| 652 opener_suppressed_(false), | 653 opener_suppressed_(false), |
| 653 suppress_dialogs_until_swap_out_(false), | 654 suppress_dialogs_until_swap_out_(false), |
| 654 page_id_(-1), | 655 page_id_(-1), |
| 655 last_page_id_sent_to_browser_(-1), | 656 last_page_id_sent_to_browser_(-1), |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 const RendererPreferences& renderer_prefs, | 921 const RendererPreferences& renderer_prefs, |
| 921 const WebPreferences& webkit_prefs, | 922 const WebPreferences& webkit_prefs, |
| 922 int32 routing_id, | 923 int32 routing_id, |
| 923 int32 main_frame_routing_id, | 924 int32 main_frame_routing_id, |
| 924 int32 surface_id, | 925 int32 surface_id, |
| 925 int64 session_storage_namespace_id, | 926 int64 session_storage_namespace_id, |
| 926 const base::string16& frame_name, | 927 const base::string16& frame_name, |
| 927 bool is_renderer_created, | 928 bool is_renderer_created, |
| 928 bool swapped_out, | 929 bool swapped_out, |
| 929 bool hidden, | 930 bool hidden, |
| 931 bool never_visible, |
| 930 int32 next_page_id, | 932 int32 next_page_id, |
| 931 const blink::WebScreenInfo& screen_info, | 933 const blink::WebScreenInfo& screen_info, |
| 932 AccessibilityMode accessibility_mode) { | 934 AccessibilityMode accessibility_mode) { |
| 933 DCHECK(routing_id != MSG_ROUTING_NONE); | 935 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 934 RenderViewImplParams params(opener_id, | 936 RenderViewImplParams params(opener_id, |
| 935 renderer_prefs, | 937 renderer_prefs, |
| 936 webkit_prefs, | 938 webkit_prefs, |
| 937 routing_id, | 939 routing_id, |
| 938 main_frame_routing_id, | 940 main_frame_routing_id, |
| 939 surface_id, | 941 surface_id, |
| 940 session_storage_namespace_id, | 942 session_storage_namespace_id, |
| 941 frame_name, | 943 frame_name, |
| 942 is_renderer_created, | 944 is_renderer_created, |
| 943 swapped_out, | 945 swapped_out, |
| 944 hidden, | 946 hidden, |
| 947 never_visible, |
| 945 next_page_id, | 948 next_page_id, |
| 946 screen_info, | 949 screen_info, |
| 947 accessibility_mode); | 950 accessibility_mode); |
| 948 RenderViewImpl* render_view = NULL; | 951 RenderViewImpl* render_view = NULL; |
| 949 if (g_create_render_view_impl) | 952 if (g_create_render_view_impl) |
| 950 render_view = g_create_render_view_impl(¶ms); | 953 render_view = g_create_render_view_impl(¶ms); |
| 951 else | 954 else |
| 952 render_view = new RenderViewImpl(¶ms); | 955 render_view = new RenderViewImpl(¶ms); |
| 953 | 956 |
| 954 RenderFrameImpl* main_frame = RenderFrameImpl::Create( | 957 RenderFrameImpl* main_frame = RenderFrameImpl::Create( |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 new ViewHostMsg_CreateWindow(params, | 1503 new ViewHostMsg_CreateWindow(params, |
| 1501 &routing_id, | 1504 &routing_id, |
| 1502 &main_frame_routing_id, | 1505 &main_frame_routing_id, |
| 1503 &surface_id, | 1506 &surface_id, |
| 1504 &cloned_session_storage_namespace_id)); | 1507 &cloned_session_storage_namespace_id)); |
| 1505 if (routing_id == MSG_ROUTING_NONE) | 1508 if (routing_id == MSG_ROUTING_NONE) |
| 1506 return NULL; | 1509 return NULL; |
| 1507 | 1510 |
| 1508 WebUserGestureIndicator::consumeUserGesture(); | 1511 WebUserGestureIndicator::consumeUserGesture(); |
| 1509 | 1512 |
| 1510 WebPreferences transferred_preferences = webkit_preferences_; | 1513 // While this view may be a background extension page, it can spawn a visible |
| 1511 | 1514 // render view. So we just assume that the new one is not another background |
| 1512 // Unless accelerated compositing has been explicitly disabled from the | 1515 // page instead of passing on our own value. |
| 1513 // command line (e.g. via the blacklist or about:flags) re-enable it for | 1516 // TODO(vangelis): Can we tell if the new view will be a background page? |
| 1514 // new views that get spawned by this view. This gets around the issue that | 1517 bool never_visible = false; |
| 1515 // background extension pages disable accelerated compositing via web prefs | |
| 1516 // but can themselves spawn a visible render view which should be allowed | |
| 1517 // use gpu acceleration. | |
| 1518 if (!webkit_preferences_.accelerated_compositing_enabled) { | |
| 1519 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 1520 if (!command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) | |
| 1521 transferred_preferences.accelerated_compositing_enabled = true; | |
| 1522 } | |
| 1523 | 1518 |
| 1524 // The initial hidden state for the RenderViewImpl here has to match what the | 1519 // The initial hidden state for the RenderViewImpl here has to match what the |
| 1525 // browser will eventually decide for the given disposition. Since we have to | 1520 // browser will eventually decide for the given disposition. Since we have to |
| 1526 // return from this call synchronously, we just have to make our best guess | 1521 // return from this call synchronously, we just have to make our best guess |
| 1527 // and rely on the browser sending a WasHidden / WasShown message if it | 1522 // and rely on the browser sending a WasHidden / WasShown message if it |
| 1528 // disagrees. | 1523 // disagrees. |
| 1529 RenderViewImpl* view = RenderViewImpl::Create( | 1524 RenderViewImpl* view = RenderViewImpl::Create( |
| 1530 routing_id_, | 1525 routing_id_, |
| 1531 renderer_preferences_, | 1526 renderer_preferences_, |
| 1532 transferred_preferences, | 1527 webkit_preferences_, |
| 1533 routing_id, | 1528 routing_id, |
| 1534 main_frame_routing_id, | 1529 main_frame_routing_id, |
| 1535 surface_id, | 1530 surface_id, |
| 1536 cloned_session_storage_namespace_id, | 1531 cloned_session_storage_namespace_id, |
| 1537 base::string16(), // WebCore will take care of setting the correct name. | 1532 base::string16(), // WebCore will take care of setting the correct name. |
| 1538 true, // is_renderer_created | 1533 true, // is_renderer_created |
| 1539 false, // swapped_out | 1534 false, // swapped_out |
| 1540 params.disposition == NEW_BACKGROUND_TAB, // hidden | 1535 params.disposition == NEW_BACKGROUND_TAB, // hidden |
| 1541 1, // next_page_id | 1536 never_visible, |
| 1537 1, // next_page_id |
| 1542 screen_info_, | 1538 screen_info_, |
| 1543 accessibility_mode_); | 1539 accessibility_mode_); |
| 1544 view->opened_by_user_gesture_ = params.user_gesture; | 1540 view->opened_by_user_gesture_ = params.user_gesture; |
| 1545 | 1541 |
| 1546 // Record whether the creator frame is trying to suppress the opener field. | 1542 // Record whether the creator frame is trying to suppress the opener field. |
| 1547 view->opener_suppressed_ = params.opener_suppressed; | 1543 view->opener_suppressed_ = params.opener_suppressed; |
| 1548 | 1544 |
| 1549 return view->webview(); | 1545 return view->webview(); |
| 1550 } | 1546 } |
| 1551 | 1547 |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4527 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); | 4523 std::vector<gfx::Size> sizes(icon_urls[i].sizes().size()); |
| 4528 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4524 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4529 if (!url.isEmpty()) | 4525 if (!url.isEmpty()) |
| 4530 urls.push_back( | 4526 urls.push_back( |
| 4531 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4527 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4532 } | 4528 } |
| 4533 SendUpdateFaviconURL(urls); | 4529 SendUpdateFaviconURL(urls); |
| 4534 } | 4530 } |
| 4535 | 4531 |
| 4536 } // namespace content | 4532 } // namespace content |
| OLD | NEW |