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

Side by Side Diff: chrome/browser/tab_contents/tab_contents_view.cc

Issue 3055009: Use RenderWidget(Host) for full screen (Closed)
Patch Set: Add IPC::SyncMessage dependency. Fix auto complete. Created 10 years, 4 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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_contents_view.h" 5 #include "chrome/browser/tab_contents/tab_contents_view.h"
6 6
7 #include "chrome/browser/renderer_host/render_process_host.h" 7 #include "chrome/browser/renderer_host/render_process_host.h"
8 #include "chrome/browser/renderer_host/render_view_host.h" 8 #include "chrome/browser/renderer_host/render_view_host.h"
9 #include "chrome/browser/renderer_host/render_widget_host.h" 9 #include "chrome/browser/renderer_host/render_widget_host.h"
10 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 10 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
(...skipping 30 matching lines...) Expand all
41 41
42 if (new_contents && tab_contents_->delegate()) 42 if (new_contents && tab_contents_->delegate())
43 tab_contents_->delegate()->TabContentsCreated(new_contents); 43 tab_contents_->delegate()->TabContentsCreated(new_contents);
44 } 44 }
45 45
46 void TabContentsView::CreateNewWidget(int route_id, 46 void TabContentsView::CreateNewWidget(int route_id,
47 WebKit::WebPopupType popup_type) { 47 WebKit::WebPopupType popup_type) {
48 CreateNewWidgetInternal(route_id, popup_type); 48 CreateNewWidgetInternal(route_id, popup_type);
49 } 49 }
50 50
51 void TabContentsView::CreateNewFullscreenWidget(
52 int route_id, WebKit::WebPopupType popup_type) {
53 CreateNewFullscreenWidgetInternal(route_id, popup_type);
54 }
55
51 void TabContentsView::ShowCreatedWindow(int route_id, 56 void TabContentsView::ShowCreatedWindow(int route_id,
52 WindowOpenDisposition disposition, 57 WindowOpenDisposition disposition,
53 const gfx::Rect& initial_pos, 58 const gfx::Rect& initial_pos,
54 bool user_gesture) { 59 bool user_gesture) {
55 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id); 60 TabContents* contents = delegate_view_helper_.GetCreatedWindow(route_id);
56 if (contents) { 61 if (contents) {
57 tab_contents()->AddNewContents(contents, disposition, initial_pos, 62 tab_contents()->AddNewContents(contents, disposition, initial_pos,
58 user_gesture); 63 user_gesture);
59 } 64 }
60 } 65 }
61 66
62 void TabContentsView::ShowCreatedWidget(int route_id, 67 void TabContentsView::ShowCreatedWidget(int route_id,
63 const gfx::Rect& initial_pos) { 68 const gfx::Rect& initial_pos) {
64 RenderWidgetHostView* widget_host_view = 69 RenderWidgetHostView* widget_host_view =
65 delegate_view_helper_.GetCreatedWidget(route_id); 70 delegate_view_helper_.GetCreatedWidget(route_id);
66 ShowCreatedWidgetInternal(widget_host_view, initial_pos); 71 ShowCreatedWidgetInternal(widget_host_view, initial_pos);
67 } 72 }
68 73
69 void TabContentsView::Activate() { 74 void TabContentsView::Activate() {
70 tab_contents_->delegate()->Activate(); 75 tab_contents_->delegate()->Activate();
71 } 76 }
72 77
73 void TabContentsView::Deactivate() { 78 void TabContentsView::Deactivate() {
74 tab_contents_->delegate()->Deactivate(); 79 tab_contents_->delegate()->Deactivate();
75 } 80 }
76 81
82 void TabContentsView::ShowCreatedFullscreenWidget(int route_id) {
83 RenderWidgetHostView* widget_host_view =
84 delegate_view_helper_.GetCreatedWidget(route_id);
85 ShowCreatedFullscreenWidgetInternal(widget_host_view);
86 }
87
77 bool TabContentsView::PreHandleKeyboardEvent( 88 bool TabContentsView::PreHandleKeyboardEvent(
78 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { 89 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) {
79 return tab_contents_->delegate() && 90 return tab_contents_->delegate() &&
80 tab_contents_->delegate()->PreHandleKeyboardEvent( 91 tab_contents_->delegate()->PreHandleKeyboardEvent(
81 event, is_keyboard_shortcut); 92 event, is_keyboard_shortcut);
82 } 93 }
83 94
84 void TabContentsView::UpdatePreferredSize(const gfx::Size& pref_size) { 95 void TabContentsView::UpdatePreferredSize(const gfx::Size& pref_size) {
85 if (tab_contents_->delegate()) 96 if (tab_contents_->delegate())
86 tab_contents_->delegate()->UpdatePreferredSize(pref_size); 97 tab_contents_->delegate()->UpdatePreferredSize(pref_size);
87 } 98 }
88 99
89 void TabContentsView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { 100 void TabContentsView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
90 if (tab_contents_->delegate()) 101 if (tab_contents_->delegate())
91 tab_contents_->delegate()->HandleKeyboardEvent(event); 102 tab_contents_->delegate()->HandleKeyboardEvent(event);
92 } 103 }
93 104
94 RenderWidgetHostView* TabContentsView::CreateNewWidgetInternal( 105 RenderWidgetHostView* TabContentsView::CreateNewWidgetInternal(
95 int route_id, WebKit::WebPopupType popup_type) { 106 int route_id, WebKit::WebPopupType popup_type) {
96 return delegate_view_helper_.CreateNewWidget(route_id, popup_type, 107 return delegate_view_helper_.CreateNewWidget(route_id, popup_type,
97 tab_contents()->render_view_host()->process()); 108 tab_contents()->render_view_host()->process());
98 } 109 }
99 110
111 RenderWidgetHostView* TabContentsView::CreateNewFullscreenWidgetInternal(
112 int route_id, WebKit::WebPopupType popup_type) {
113 return delegate_view_helper_.CreateNewFullscreenWidget(
114 route_id, popup_type, tab_contents()->render_view_host()->process());
115 }
116
100 void TabContentsView::ShowCreatedWidgetInternal( 117 void TabContentsView::ShowCreatedWidgetInternal(
101 RenderWidgetHostView* widget_host_view, const gfx::Rect& initial_pos) { 118 RenderWidgetHostView* widget_host_view, const gfx::Rect& initial_pos) {
102 if (tab_contents_->delegate()) 119 if (tab_contents_->delegate())
103 tab_contents_->delegate()->RenderWidgetShowing(); 120 tab_contents_->delegate()->RenderWidgetShowing();
104 121
105 widget_host_view->InitAsPopup(tab_contents_->GetRenderWidgetHostView(), 122 widget_host_view->InitAsPopup(tab_contents_->GetRenderWidgetHostView(),
106 initial_pos); 123 initial_pos);
107 widget_host_view->GetRenderWidgetHost()->Init(); 124 widget_host_view->GetRenderWidgetHost()->Init();
108 } 125 }
126
127 void TabContentsView::ShowCreatedFullscreenWidgetInternal(
128 RenderWidgetHostView* widget_host_view) {
129 if (tab_contents_->delegate())
130 tab_contents_->delegate()->RenderWidgetShowing();
131
132 widget_host_view->InitAsFullscreen(tab_contents_->GetRenderWidgetHostView());
133 widget_host_view->GetRenderWidgetHost()->Init();
134 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698