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 "ui/views/controls/webview/webview.h" | 7 #include "ui/views/controls/webview/webview.h" |
8 | 8 |
9 // static | 9 // static |
10 const char ContentsContainer::kViewClassName[] = | 10 const char ContentsContainer::kViewClassName[] = |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 preview_ = preview; | 47 preview_ = preview; |
48 if (preview_) | 48 if (preview_) |
49 AddChildView(preview_); | 49 AddChildView(preview_); |
50 } | 50 } |
51 preview_web_contents_ = preview_web_contents; | 51 preview_web_contents_ = preview_web_contents; |
52 preview_height_ = height; | 52 preview_height_ = height; |
53 preview_height_units_ = units; | 53 preview_height_units_ = units; |
54 Layout(); | 54 Layout(); |
55 } | 55 } |
56 | 56 |
57 void ContentsContainer::MaybeStackPreviewAtTop() { | |
58 if (preview_) { | |
59 RemoveChildView(preview_); | |
sky
2012/11/29 20:57:55
Will this result in sending a bunch of messages to
| |
60 AddChildView(preview_); | |
61 Layout(); | |
62 } | |
63 } | |
64 | |
57 void ContentsContainer::SetActiveTopMargin(int margin) { | 65 void ContentsContainer::SetActiveTopMargin(int margin) { |
58 if (active_top_margin_ == margin) | 66 if (active_top_margin_ == margin) |
59 return; | 67 return; |
60 | 68 |
61 active_top_margin_ = margin; | 69 active_top_margin_ = margin; |
62 // Make sure we layout next time around. We need this in case our bounds | 70 // Make sure we layout next time around. We need this in case our bounds |
63 // haven't changed. | 71 // haven't changed. |
64 InvalidateLayout(); | 72 InvalidateLayout(); |
65 } | 73 } |
66 | 74 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 switch (preview_height_units_) { | 107 switch (preview_height_units_) { |
100 case INSTANT_SIZE_PERCENT: | 108 case INSTANT_SIZE_PERCENT: |
101 return std::min(height(), (height() * preview_height_) / 100); | 109 return std::min(height(), (height() * preview_height_) / 100); |
102 | 110 |
103 case INSTANT_SIZE_PIXELS: | 111 case INSTANT_SIZE_PIXELS: |
104 return std::min(height(), preview_height_); | 112 return std::min(height(), preview_height_); |
105 } | 113 } |
106 NOTREACHED() << "unknown units: " << preview_height_units_; | 114 NOTREACHED() << "unknown units: " << preview_height_units_; |
107 return 0; | 115 return 0; |
108 } | 116 } |
OLD | NEW |