• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "content/renderer/render_widget_fullscreen.h"
6 
7 #include "content/common/view_messages.h"
8 #include "third_party/WebKit/public/web/WebWidget.h"
9 
10 using blink::WebWidget;
11 
12 namespace content {
13 
show(blink::WebNavigationPolicy)14 void RenderWidgetFullscreen::show(blink::WebNavigationPolicy) {
15   DCHECK(!did_show_) << "received extraneous Show call";
16   DCHECK_NE(MSG_ROUTING_NONE, routing_id_);
17   DCHECK_NE(MSG_ROUTING_NONE, opener_id_);
18 
19   if (!did_show_) {
20     did_show_ = true;
21     Send(new ViewHostMsg_ShowFullscreenWidget(opener_id_, routing_id_));
22     SetPendingWindowRect(initial_pos_);
23   }
24 }
25 
RenderWidgetFullscreen(const blink::WebScreenInfo & screen_info)26 RenderWidgetFullscreen::RenderWidgetFullscreen(
27     const blink::WebScreenInfo& screen_info)
28     : RenderWidget(blink::WebPopupTypeNone, screen_info, false, false, false) {}
29 
~RenderWidgetFullscreen()30 RenderWidgetFullscreen::~RenderWidgetFullscreen() {}
31 
CreateWebWidget()32 WebWidget* RenderWidgetFullscreen::CreateWebWidget() {
33   // TODO(boliu): Handle full screen render widgets here.
34   return RenderWidget::CreateWebWidget(this);
35 }
36 
Init(int32 opener_id)37 bool RenderWidgetFullscreen::Init(int32 opener_id) {
38   DCHECK(!webwidget_);
39 
40   return RenderWidget::DoInit(
41       opener_id,
42       CreateWebWidget(),
43       new ViewHostMsg_CreateFullscreenWidget(
44           opener_id, &routing_id_, &surface_id_));
45 }
46 
47 }  // namespace content
48