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 "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/ui/constrained_window.h" | 10 #include "chrome/browser/ui/constrained_window.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { | 74 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { |
75 native_tab_contents_view_ = | 75 native_tab_contents_view_ = |
76 NativeTabContentsView::CreateNativeTabContentsView(this); | 76 NativeTabContentsView::CreateNativeTabContentsView(this); |
77 native_tab_contents_view_->InitNativeTabContentsView(); | 77 native_tab_contents_view_->InitNativeTabContentsView(); |
78 } | 78 } |
79 | 79 |
80 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( | 80 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( |
81 RenderWidgetHost* render_widget_host) { | 81 RenderWidgetHost* render_widget_host) { |
82 if (render_widget_host->view()) { | 82 if (render_widget_host->GetView()) { |
83 // During testing, the view will already be set up in most cases to the | 83 // During testing, the view will already be set up in most cases to the |
84 // test view, so we don't want to clobber it with a real one. To verify that | 84 // test view, so we don't want to clobber it with a real one. To verify that |
85 // this actually is happening (and somebody isn't accidentally creating the | 85 // this actually is happening (and somebody isn't accidentally creating the |
86 // view twice), we check for the RVH Factory, which will be set when we're | 86 // view twice), we check for the RVH Factory, which will be set when we're |
87 // making special ones (which go along with the special views). | 87 // making special ones (which go along with the special views). |
88 DCHECK(RenderViewHostFactory::has_factory()); | 88 DCHECK(RenderViewHostFactory::has_factory()); |
89 return render_widget_host->view(); | 89 return render_widget_host->GetView(); |
90 } | 90 } |
91 | 91 |
92 return native_tab_contents_view_->CreateRenderWidgetHostView( | 92 return native_tab_contents_view_->CreateRenderWidgetHostView( |
93 render_widget_host); | 93 render_widget_host); |
94 } | 94 } |
95 | 95 |
96 gfx::NativeView TabContentsViewViews::GetNativeView() const { | 96 gfx::NativeView TabContentsViewViews::GetNativeView() const { |
97 return Widget::GetNativeView(); | 97 return Widget::GetNativeView(); |
98 } | 98 } |
99 | 99 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 // We may not have a focus manager if the tab has been switched before this | 290 // We may not have a focus manager if the tab has been switched before this |
291 // message arrived. | 291 // message arrived. |
292 if (focus_manager) | 292 if (focus_manager) |
293 focus_manager->AdvanceFocus(reverse); | 293 focus_manager->AdvanceFocus(reverse); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 void TabContentsViewViews::CloseTab() { | 297 void TabContentsViewViews::CloseTab() { |
298 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 298 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
299 rvh->delegate()->Close(rvh); | 299 rvh->GetDelegate()->Close(rvh); |
300 } | 300 } |
301 | 301 |
302 void TabContentsViewViews::CreateNewWindow( | 302 void TabContentsViewViews::CreateNewWindow( |
303 int route_id, | 303 int route_id, |
304 const ViewHostMsg_CreateWindow_Params& params) { | 304 const ViewHostMsg_CreateWindow_Params& params) { |
305 tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); | 305 tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); |
306 } | 306 } |
307 | 307 |
308 void TabContentsViewViews::CreateNewWidget( | 308 void TabContentsViewViews::CreateNewWidget( |
309 int route_id, WebKit::WebPopupType popup_type) { | 309 int route_id, WebKit::WebPopupType popup_type) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 web_contents_->HideContents(); | 469 web_contents_->HideContents(); |
470 } | 470 } |
471 } | 471 } |
472 | 472 |
473 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 473 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
474 const gfx::Size& new_size) { | 474 const gfx::Size& new_size) { |
475 if (overlaid_view_) | 475 if (overlaid_view_) |
476 overlaid_view_->SetBounds(gfx::Rect(new_size)); | 476 overlaid_view_->SetBounds(gfx::Rect(new_size)); |
477 views::Widget::OnNativeWidgetSizeChanged(new_size); | 477 views::Widget::OnNativeWidgetSizeChanged(new_size); |
478 } | 478 } |
OLD | NEW |