| 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 16 matching lines...) Expand all Loading... |
| 27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 | 28 |
| 29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 30 #include <windows.h> | 30 #include <windows.h> |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 using WebKit::WebDragOperation; | 33 using WebKit::WebDragOperation; |
| 34 using WebKit::WebDragOperationNone; | 34 using WebKit::WebDragOperationNone; |
| 35 using WebKit::WebDragOperationsMask; | 35 using WebKit::WebDragOperationsMask; |
| 36 using WebKit::WebInputEvent; | 36 using WebKit::WebInputEvent; |
| 37 using content::RenderViewHost; |
| 37 using content::RenderWidgetHostView; | 38 using content::RenderWidgetHostView; |
| 38 using content::WebContents; | 39 using content::WebContents; |
| 39 | 40 |
| 40 TabContentsViewViews::TabContentsViewViews(WebContents* web_contents) | 41 TabContentsViewViews::TabContentsViewViews(WebContents* web_contents) |
| 41 : web_contents_(web_contents), | 42 : web_contents_(web_contents), |
| 42 native_tab_contents_view_(NULL), | 43 native_tab_contents_view_(NULL), |
| 43 close_tab_after_drag_ends_(false), | 44 close_tab_after_drag_ends_(false), |
| 44 focus_manager_(NULL) { | 45 focus_manager_(NULL) { |
| 45 last_focused_view_storage_id_ = | 46 last_focused_view_storage_id_ = |
| 46 views::ViewStorage::GetInstance()->CreateStorageID(); | 47 views::ViewStorage::GetInstance()->CreateStorageID(); |
| (...skipping 17 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 453 } |
| 453 } | 454 } |
| 454 | 455 |
| 455 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 456 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
| 456 const gfx::Size& new_size) { | 457 const gfx::Size& new_size) { |
| 457 views::Widget* sad_tab = GetSadTab(); | 458 views::Widget* sad_tab = GetSadTab(); |
| 458 if (sad_tab) | 459 if (sad_tab) |
| 459 sad_tab->SetBounds(gfx::Rect(new_size)); | 460 sad_tab->SetBounds(gfx::Rect(new_size)); |
| 460 views::Widget::OnNativeWidgetSizeChanged(new_size); | 461 views::Widget::OnNativeWidgetSizeChanged(new_size); |
| 461 } | 462 } |
| OLD | NEW |