| 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 15 matching lines...) Expand all Loading... |
| 26 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 27 | 27 |
| 28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 29 #include <windows.h> | 29 #include <windows.h> |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 using WebKit::WebDragOperation; | 32 using WebKit::WebDragOperation; |
| 33 using WebKit::WebDragOperationNone; | 33 using WebKit::WebDragOperationNone; |
| 34 using WebKit::WebDragOperationsMask; | 34 using WebKit::WebDragOperationsMask; |
| 35 using WebKit::WebInputEvent; | 35 using WebKit::WebInputEvent; |
| 36 using content::RenderViewHost; |
| 36 using content::RenderWidgetHostView; | 37 using content::RenderWidgetHostView; |
| 37 using content::WebContents; | 38 using content::WebContents; |
| 38 | 39 |
| 39 TabContentsViewViews::TabContentsViewViews(WebContents* web_contents) | 40 TabContentsViewViews::TabContentsViewViews(WebContents* web_contents) |
| 40 : web_contents_(web_contents), | 41 : web_contents_(web_contents), |
| 41 native_tab_contents_view_(NULL), | 42 native_tab_contents_view_(NULL), |
| 42 close_tab_after_drag_ends_(false), | 43 close_tab_after_drag_ends_(false), |
| 43 focus_manager_(NULL), | 44 focus_manager_(NULL), |
| 44 overlaid_view_(NULL) { | 45 overlaid_view_(NULL) { |
| 45 last_focused_view_storage_id_ = | 46 last_focused_view_storage_id_ = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 native_tab_contents_view_->Unparent(); | 65 native_tab_contents_view_->Unparent(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { | 68 void TabContentsViewViews::CreateView(const gfx::Size& initial_size) { |
| 68 native_tab_contents_view_ = | 69 native_tab_contents_view_ = |
| 69 NativeTabContentsView::CreateNativeTabContentsView(this); | 70 NativeTabContentsView::CreateNativeTabContentsView(this); |
| 70 native_tab_contents_view_->InitNativeTabContentsView(); | 71 native_tab_contents_view_->InitNativeTabContentsView(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( | 74 RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget( |
| 74 RenderWidgetHost* render_widget_host) { | 75 content::RenderWidgetHost* render_widget_host) { |
| 75 if (render_widget_host->GetView()) { | 76 if (render_widget_host->GetView()) { |
| 76 // During testing, the view will already be set up in most cases to the | 77 // 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 | 78 // 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 | 79 // 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 | 80 // 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). | 81 // making special ones (which go along with the special views). |
| 81 DCHECK(RenderViewHostFactory::has_factory()); | 82 DCHECK(RenderViewHostFactory::has_factory()); |
| 82 return render_widget_host->GetView(); | 83 return render_widget_host->GetView(); |
| 83 } | 84 } |
| 84 | 85 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 web_contents_->HideContents(); | 463 web_contents_->HideContents(); |
| 463 } | 464 } |
| 464 } | 465 } |
| 465 | 466 |
| 466 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 467 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
| 467 const gfx::Size& new_size) { | 468 const gfx::Size& new_size) { |
| 468 if (overlaid_view_) | 469 if (overlaid_view_) |
| 469 overlaid_view_->SetBounds(gfx::Rect(new_size)); | 470 overlaid_view_->SetBounds(gfx::Rect(new_size)); |
| 470 views::Widget::OnNativeWidgetSizeChanged(new_size); | 471 views::Widget::OnNativeWidgetSizeChanged(new_size); |
| 471 } | 472 } |
| OLD | NEW |