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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 9721001: Plumb Guest flag to RenderViewImpl (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated broken render_view_test Created 8 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 | Annotate | Revision Log
OLDNEW
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 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 gfx::NativeViewId parent_hwnd, 417 gfx::NativeViewId parent_hwnd,
418 int32 opener_id, 418 int32 opener_id,
419 const content::RendererPreferences& renderer_prefs, 419 const content::RendererPreferences& renderer_prefs,
420 const WebPreferences& webkit_prefs, 420 const WebPreferences& webkit_prefs,
421 SharedRenderViewCounter* counter, 421 SharedRenderViewCounter* counter,
422 int32 routing_id, 422 int32 routing_id,
423 int32 surface_id, 423 int32 surface_id,
424 int64 session_storage_namespace_id, 424 int64 session_storage_namespace_id,
425 const string16& frame_name, 425 const string16& frame_name,
426 int32 next_page_id, 426 int32 next_page_id,
427 const WebKit::WebScreenInfo& screen_info) 427 const WebKit::WebScreenInfo& screen_info,
428 bool guest)
428 : RenderWidget(WebKit::WebPopupTypeNone, screen_info), 429 : RenderWidget(WebKit::WebPopupTypeNone, screen_info),
429 webkit_preferences_(webkit_prefs), 430 webkit_preferences_(webkit_prefs),
430 send_content_state_immediately_(false), 431 send_content_state_immediately_(false),
431 enabled_bindings_(0), 432 enabled_bindings_(0),
432 send_preferred_size_changes_(false), 433 send_preferred_size_changes_(false),
433 is_loading_(false), 434 is_loading_(false),
434 navigation_gesture_(NavigationGestureUnknown), 435 navigation_gesture_(NavigationGestureUnknown),
435 opened_by_user_gesture_(true), 436 opened_by_user_gesture_(true),
436 opener_suppressed_(false), 437 opener_suppressed_(false),
437 page_id_(-1), 438 page_id_(-1),
(...skipping 17 matching lines...) Expand all
455 media_stream_dispatcher_(NULL), 456 media_stream_dispatcher_(NULL),
456 p2p_socket_dispatcher_(NULL), 457 p2p_socket_dispatcher_(NULL),
457 devtools_agent_(NULL), 458 devtools_agent_(NULL),
458 renderer_accessibility_(NULL), 459 renderer_accessibility_(NULL),
459 mouse_lock_dispatcher_(NULL), 460 mouse_lock_dispatcher_(NULL),
460 session_storage_namespace_id_(session_storage_namespace_id), 461 session_storage_namespace_id_(session_storage_namespace_id),
461 handling_select_range_(false), 462 handling_select_range_(false),
462 #if defined(OS_WIN) 463 #if defined(OS_WIN)
463 focused_plugin_id_(-1), 464 focused_plugin_id_(-1),
464 #endif 465 #endif
466 guest_(guest),
465 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) { 467 ALLOW_THIS_IN_INITIALIZER_LIST(pepper_delegate_(this)) {
466 routing_id_ = routing_id; 468 routing_id_ = routing_id;
467 surface_id_ = surface_id; 469 surface_id_ = surface_id;
468 if (opener_id != MSG_ROUTING_NONE) 470 if (opener_id != MSG_ROUTING_NONE)
469 opener_id_ = opener_id; 471 opener_id_ = opener_id;
470 472
471 // Ensure we start with a valid next_page_id_ from the browser. 473 // Ensure we start with a valid next_page_id_ from the browser.
472 DCHECK_GE(next_page_id_, 0); 474 DCHECK_GE(next_page_id_, 0);
473 475
474 #if defined(ENABLE_NOTIFICATIONS) 476 #if defined(ENABLE_NOTIFICATIONS)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 gfx::NativeViewId parent_hwnd, 620 gfx::NativeViewId parent_hwnd,
619 int32 opener_id, 621 int32 opener_id,
620 const content::RendererPreferences& renderer_prefs, 622 const content::RendererPreferences& renderer_prefs,
621 const WebPreferences& webkit_prefs, 623 const WebPreferences& webkit_prefs,
622 SharedRenderViewCounter* counter, 624 SharedRenderViewCounter* counter,
623 int32 routing_id, 625 int32 routing_id,
624 int32 surface_id, 626 int32 surface_id,
625 int64 session_storage_namespace_id, 627 int64 session_storage_namespace_id,
626 const string16& frame_name, 628 const string16& frame_name,
627 int32 next_page_id, 629 int32 next_page_id,
628 const WebKit::WebScreenInfo& screen_info) { 630 const WebKit::WebScreenInfo& screen_info,
631 bool guest) {
629 DCHECK(routing_id != MSG_ROUTING_NONE); 632 DCHECK(routing_id != MSG_ROUTING_NONE);
630 return new RenderViewImpl( 633 return new RenderViewImpl(
631 parent_hwnd, 634 parent_hwnd,
632 opener_id, 635 opener_id,
633 renderer_prefs, 636 renderer_prefs,
634 webkit_prefs, 637 webkit_prefs,
635 counter, 638 counter,
636 routing_id, 639 routing_id,
637 surface_id, 640 surface_id,
638 session_storage_namespace_id, 641 session_storage_namespace_id,
639 frame_name, 642 frame_name,
640 next_page_id, 643 next_page_id,
641 screen_info); 644 screen_info,
645 guest);
642 } 646 }
643 647
644 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler( 648 WebKit::WebPeerConnectionHandler* RenderViewImpl::CreatePeerConnectionHandler(
645 WebKit::WebPeerConnectionHandlerClient* client) { 649 WebKit::WebPeerConnectionHandlerClient* client) {
646 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 650 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
647 if (!cmd_line->HasSwitch(switches::kEnableMediaStream)) 651 if (!cmd_line->HasSwitch(switches::kEnableMediaStream))
648 return NULL; 652 return NULL;
649 EnsureMediaStreamImpl(); 653 EnsureMediaStreamImpl();
650 if (!media_stream_impl_.get()) 654 if (!media_stream_impl_.get())
651 return NULL; 655 return NULL;
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 int64 cloned_session_storage_namespace_id; 1479 int64 cloned_session_storage_namespace_id;
1476 1480
1477 RenderThread::Get()->Send( 1481 RenderThread::Get()->Send(
1478 new ViewHostMsg_CreateWindow(params, 1482 new ViewHostMsg_CreateWindow(params,
1479 &routing_id, 1483 &routing_id,
1480 &surface_id, 1484 &surface_id,
1481 &cloned_session_storage_namespace_id)); 1485 &cloned_session_storage_namespace_id));
1482 if (routing_id == MSG_ROUTING_NONE) 1486 if (routing_id == MSG_ROUTING_NONE)
1483 return NULL; 1487 return NULL;
1484 1488
1489 // TODO(fsamuel): The host renderer needs to be able to control whether
1490 // the guest renderer is allowed to do this or not. This current
1491 // behavior is not well defined.
1485 RenderViewImpl* view = RenderViewImpl::Create( 1492 RenderViewImpl* view = RenderViewImpl::Create(
1486 0, 1493 0,
1487 routing_id_, 1494 routing_id_,
1488 renderer_preferences_, 1495 renderer_preferences_,
1489 webkit_preferences_, 1496 webkit_preferences_,
1490 shared_popup_counter_, 1497 shared_popup_counter_,
1491 routing_id, 1498 routing_id,
1492 surface_id, 1499 surface_id,
1493 cloned_session_storage_namespace_id, 1500 cloned_session_storage_namespace_id,
1494 frame_name, 1501 frame_name,
1495 1, 1502 1,
1496 screen_info_); 1503 screen_info_,
1504 guest_);
1497 view->opened_by_user_gesture_ = params.user_gesture; 1505 view->opened_by_user_gesture_ = params.user_gesture;
1498 1506
1499 // Record whether the creator frame is trying to suppress the opener field. 1507 // Record whether the creator frame is trying to suppress the opener field.
1500 view->opener_suppressed_ = params.opener_suppressed; 1508 view->opener_suppressed_ = params.opener_suppressed;
1501 1509
1502 // Record the security origin of the creator. 1510 // Record the security origin of the creator.
1503 GURL creator_url(creator->document().securityOrigin().toString().utf8()); 1511 GURL creator_url(creator->document().securityOrigin().toString().utf8());
1504 if (!creator_url.is_valid() || !creator_url.IsStandard()) 1512 if (!creator_url.is_valid() || !creator_url.IsStandard())
1505 creator_url = GURL(); 1513 creator_url = GURL();
1506 view->creator_url_ = creator_url; 1514 view->creator_url_ = creator_url;
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 // content::RenderView implementation ------------------------------------------ 3422 // content::RenderView implementation ------------------------------------------
3415 3423
3416 bool RenderViewImpl::Send(IPC::Message* message) { 3424 bool RenderViewImpl::Send(IPC::Message* message) {
3417 return RenderWidget::Send(message); 3425 return RenderWidget::Send(message);
3418 } 3426 }
3419 3427
3420 int RenderViewImpl::GetRoutingID() const { 3428 int RenderViewImpl::GetRoutingID() const {
3421 return routing_id_; 3429 return routing_id_;
3422 } 3430 }
3423 3431
3432 bool RenderViewImpl::IsGuest() const {
3433 return guest_;
3434 }
3435
3424 int RenderViewImpl::GetPageId() { 3436 int RenderViewImpl::GetPageId() {
3425 return page_id_; 3437 return page_id_;
3426 } 3438 }
3427 3439
3428 gfx::Size RenderViewImpl::GetSize() { 3440 gfx::Size RenderViewImpl::GetSize() {
3429 return size(); 3441 return size();
3430 } 3442 }
3431 3443
3432 gfx::NativeViewId RenderViewImpl::GetHostWindow() { 3444 gfx::NativeViewId RenderViewImpl::GetHostWindow() {
3433 return host_window(); 3445 return host_window();
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
5182 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5194 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5183 return !!RenderThreadImpl::current()->compositor_thread(); 5195 return !!RenderThreadImpl::current()->compositor_thread();
5184 } 5196 }
5185 5197
5186 void RenderViewImpl::OnJavaBridgeInit() { 5198 void RenderViewImpl::OnJavaBridgeInit() {
5187 DCHECK(!java_bridge_dispatcher_.get()); 5199 DCHECK(!java_bridge_dispatcher_.get());
5188 #if defined(ENABLE_JAVA_BRIDGE) 5200 #if defined(ENABLE_JAVA_BRIDGE)
5189 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5201 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5190 #endif 5202 #endif
5191 } 5203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698