OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame/contents_container.h" | 5 #include "chrome/browser/ui/views/frame/contents_container.h" |
6 | 6 |
7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // back. | 168 // back. |
169 // See comments in SetPreview() for why shadow view is removed. | 169 // See comments in SetPreview() for why shadow view is removed. |
170 bool removed_shadow = RemoveShadowView(false); | 170 bool removed_shadow = RemoveShadowView(false); |
171 RemoveChildView(preview_); | 171 RemoveChildView(preview_); |
172 AddChildView(preview_); | 172 AddChildView(preview_); |
173 if (removed_shadow) // Add back shadow view if it was removed. | 173 if (removed_shadow) // Add back shadow view if it was removed. |
174 AddChildView(shadow_view_.get()); | 174 AddChildView(shadow_view_.get()); |
175 Layout(); | 175 Layout(); |
176 } | 176 } |
177 | 177 |
| 178 int ContentsContainer::preview_height() const { |
| 179 return preview_ ? preview_->bounds().height() : 0; |
| 180 } |
| 181 |
178 void ContentsContainer::SetActiveTopMargin(int margin) { | 182 void ContentsContainer::SetActiveTopMargin(int margin) { |
179 if (active_top_margin_ == margin) | 183 if (active_top_margin_ == margin) |
180 return; | 184 return; |
181 | 185 |
182 active_top_margin_ = margin; | 186 active_top_margin_ = margin; |
183 // Make sure we layout next time around. We need this in case our bounds | 187 // Make sure we layout next time around. We need this in case our bounds |
184 // haven't changed. | 188 // haven't changed. |
185 InvalidateLayout(); | 189 InvalidateLayout(); |
186 } | 190 } |
187 | 191 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 242 |
239 RemoveChildView(shadow_view_.get()); | 243 RemoveChildView(shadow_view_.get()); |
240 if (delete_view) | 244 if (delete_view) |
241 shadow_view_.reset(NULL); | 245 shadow_view_.reset(NULL); |
242 return true; | 246 return true; |
243 } | 247 } |
244 | 248 |
245 std::string ContentsContainer::GetClassName() const { | 249 std::string ContentsContainer::GetClassName() const { |
246 return kViewClassName; | 250 return kViewClassName; |
247 } | 251 } |
OLD | NEW |