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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { | 67 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { |
68 native_tab_contents_view_ = | 68 native_tab_contents_view_ = |
69 NativeTabContentsView::CreateNativeTabContentsView(this); | 69 NativeTabContentsView::CreateNativeTabContentsView(this); |
70 native_tab_contents_view_->InitNativeTabContentsView(); | 70 native_tab_contents_view_->InitNativeTabContentsView(); |
71 } | 71 } |
72 | 72 |
73 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( | 73 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( |
74 RenderWidgetHost* render_widget_host) { | 74 RenderWidgetHost* render_widget_host) { |
75 if (render_widget_host->view()) { | 75 if (render_widget_host->GetView()) { |
76 // During testing, the view will already be set up in most cases to the | 76 // During testing, the view will already be set up in most cases to the |
77 // test view, so we don't want to clobber it with a real one. To verify that | 77 // test view, so we don't want to clobber it with a real one. To verify that |
78 // this actually is happening (and somebody isn't accidentally creating the | 78 // this actually is happening (and somebody isn't accidentally creating the |
79 // view twice), we check for the RVH Factory, which will be set when we're | 79 // view twice), we check for the RVH Factory, which will be set when we're |
80 // making special ones (which go along with the special views). | 80 // making special ones (which go along with the special views). |
81 DCHECK(RenderViewHostFactory::has_factory()); | 81 DCHECK(RenderViewHostFactory::has_factory()); |
82 return render_widget_host->view(); | 82 return render_widget_host->GetView(); |
83 } | 83 } |
84 | 84 |
85 return native_tab_contents_view_->CreateRenderWidgetHostView( | 85 return native_tab_contents_view_->CreateRenderWidgetHostView( |
86 render_widget_host); | 86 render_widget_host); |
87 } | 87 } |
88 | 88 |
89 gfx::NativeView TabContentsViewViews::GetNativeView() const { | 89 gfx::NativeView TabContentsViewViews::GetNativeView() const { |
90 return Widget::GetNativeView(); | 90 return Widget::GetNativeView(); |
91 } | 91 } |
92 | 92 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 // We may not have a focus manager if the tab has been switched before this | 283 // We may not have a focus manager if the tab has been switched before this |
284 // message arrived. | 284 // message arrived. |
285 if (focus_manager) | 285 if (focus_manager) |
286 focus_manager->AdvanceFocus(reverse); | 286 focus_manager->AdvanceFocus(reverse); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 void TabContentsViewViews::CloseTab() { | 290 void TabContentsViewViews::CloseTab() { |
291 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 291 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
292 rvh->delegate()->Close(rvh); | 292 rvh->GetDelegate()->Close(rvh); |
293 } | 293 } |
294 | 294 |
295 void TabContentsViewViews::CreateNewWindow( | 295 void TabContentsViewViews::CreateNewWindow( |
296 int route_id, | 296 int route_id, |
297 const ViewHostMsg_CreateWindow_Params& params) { | 297 const ViewHostMsg_CreateWindow_Params& params) { |
298 tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); | 298 tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); |
299 } | 299 } |
300 | 300 |
301 void TabContentsViewViews::CreateNewWidget( | 301 void TabContentsViewViews::CreateNewWidget( |
302 int route_id, WebKit::WebPopupType popup_type) { | 302 int route_id, WebKit::WebPopupType popup_type) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 web_contents_->HideContents(); | 462 web_contents_->HideContents(); |
463 } | 463 } |
464 } | 464 } |
465 | 465 |
466 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 466 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
467 const gfx::Size& new_size) { | 467 const gfx::Size& new_size) { |
468 if (overlaid_view_) | 468 if (overlaid_view_) |
469 overlaid_view_->SetBounds(gfx::Rect(new_size)); | 469 overlaid_view_->SetBounds(gfx::Rect(new_size)); |
470 views::Widget::OnNativeWidgetSizeChanged(new_size); | 470 views::Widget::OnNativeWidgetSizeChanged(new_size); |
471 } | 471 } |
OLD | NEW |