| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_container.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/view_ids.h" | 7 #include "chrome/browser/ui/view_ids.h" |
| 8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" | 8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" |
| 9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_view.h" | 10 #include "content/browser/renderer_host/render_widget_host_view.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 TabContentsDestroyed(content::Source<TabContents>(source).ptr()); | 78 TabContentsDestroyed(content::Source<TabContents>(source).ptr()); |
| 79 } else { | 79 } else { |
| 80 NOTREACHED(); | 80 NOTREACHED(); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
| 85 // TabContentsContainer, View overrides: | 85 // TabContentsContainer, View overrides: |
| 86 | 86 |
| 87 void TabContentsContainer::Layout() { | 87 void TabContentsContainer::Layout() { |
| 88 if (native_container_) | 88 if (native_container_) { |
| 89 gfx::Size view_size(native_container_->GetView()->size()); |
| 89 native_container_->GetView()->SetBounds(0, 0, width(), height()); | 90 native_container_->GetView()->SetBounds(0, 0, width(), height()); |
| 91 // SetBounds does nothing if the bounds haven't changed. We need to force |
| 92 // layout if the bounds haven't changed, but fast resize has. |
| 93 if (view_size.width() == width() && view_size.height() == height() && |
| 94 native_container_->FastResizeAtLastLayout() && |
| 95 !native_container_->GetFastResize()) { |
| 96 native_container_->GetView()->Layout(); |
| 97 } |
| 98 } |
| 90 } | 99 } |
| 91 | 100 |
| 92 void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) { | 101 void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) { |
| 93 state->role = ui::AccessibilityTypes::ROLE_WINDOW; | 102 state->role = ui::AccessibilityTypes::ROLE_WINDOW; |
| 94 } | 103 } |
| 95 | 104 |
| 96 #if defined(HAVE_XINPUT2) | 105 #if defined(HAVE_XINPUT2) |
| 97 bool TabContentsContainer::OnMousePressed(const views::MouseEvent& event) { | 106 bool TabContentsContainer::OnMousePressed(const views::MouseEvent& event) { |
| 98 DCHECK(tab_contents_); | 107 DCHECK(tab_contents_); |
| 99 if (event.flags() & (ui::EF_LEFT_BUTTON_DOWN | | 108 if (event.flags() & (ui::EF_LEFT_BUTTON_DOWN | |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // us to clean up our state in case this happens. | 187 // us to clean up our state in case this happens. |
| 179 DCHECK(contents == tab_contents_); | 188 DCHECK(contents == tab_contents_); |
| 180 ChangeTabContents(NULL); | 189 ChangeTabContents(NULL); |
| 181 } | 190 } |
| 182 | 191 |
| 183 void TabContentsContainer::RenderWidgetHostViewChanged( | 192 void TabContentsContainer::RenderWidgetHostViewChanged( |
| 184 RenderWidgetHostView* new_view) { | 193 RenderWidgetHostView* new_view) { |
| 185 if (new_view) | 194 if (new_view) |
| 186 new_view->set_reserved_contents_rect(cached_reserved_rect_); | 195 new_view->set_reserved_contents_rect(cached_reserved_rect_); |
| 187 } | 196 } |
| OLD | NEW |