OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/frame/contents_container.h" | 5 #include "chrome/browser/views/frame/contents_container.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "chrome/browser/location_bar.h" | 8 #include "chrome/browser/location_bar.h" |
9 #include "chrome/browser/views/frame/browser_view.h" | 9 #include "chrome/browser/views/frame/browser_view.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void ContentsContainer::SetActiveTopMargin(int margin) { | 103 void ContentsContainer::SetActiveTopMargin(int margin) { |
104 if (active_top_margin_ == margin) | 104 if (active_top_margin_ == margin) |
105 return; | 105 return; |
106 | 106 |
107 active_top_margin_ = margin; | 107 active_top_margin_ = margin; |
108 // Make sure we layout next time around. We need this in case our bounds | 108 // Make sure we layout next time around. We need this in case our bounds |
109 // haven't changed. | 109 // haven't changed. |
110 InvalidateLayout(); | 110 InvalidateLayout(); |
111 } | 111 } |
112 | 112 |
| 113 gfx::Rect ContentsContainer::GetPreviewBounds() { |
| 114 gfx::Point screen_loc; |
| 115 ConvertPointToScreen(this, &screen_loc); |
| 116 return gfx::Rect(screen_loc, size()); |
| 117 } |
| 118 |
113 void ContentsContainer::Layout() { | 119 void ContentsContainer::Layout() { |
114 // The active view always gets the full bounds. | 120 // The active view always gets the full bounds. |
115 active_->SetBounds(0, active_top_margin_, width(), | 121 active_->SetBounds(0, active_top_margin_, width(), |
116 std::max(0, height() - active_top_margin_)); | 122 std::max(0, height() - active_top_margin_)); |
117 | 123 |
118 if (preview_) { | 124 if (preview_) { |
119 preview_->SetBounds(0, 0, width(), height()); | 125 preview_->SetBounds(0, 0, width(), height()); |
120 PositionTearWindow(); | 126 PositionTearWindow(); |
121 } | 127 } |
122 | 128 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 #if defined(OS_WIN) | 191 #if defined(OS_WIN) |
186 tear_window_->set_contents_container(NULL); | 192 tear_window_->set_contents_container(NULL); |
187 #endif | 193 #endif |
188 // Close deletes the tear window. | 194 // Close deletes the tear window. |
189 tear_window_ = NULL; | 195 tear_window_ = NULL; |
190 } | 196 } |
191 | 197 |
192 void ContentsContainer::TearWindowDestroyed() { | 198 void ContentsContainer::TearWindowDestroyed() { |
193 tear_window_ = NULL; | 199 tear_window_ = NULL; |
194 } | 200 } |
OLD | NEW |