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/frame/contents_container.h" | 5 #include "chrome/browser/ui/views/frame/contents_container.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/base/animation/slide_animation.h" | 9 #include "ui/base/animation/slide_animation.h" |
10 #include "views/background.h" | 10 #include "views/background.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (preview_) | 145 if (preview_) |
146 preview_->SetBounds(0, 0, width(), height()); | 146 preview_->SetBounds(0, 0, width(), height()); |
147 | 147 |
148 // Need to invoke views::View in case any views whose bounds didn't change | 148 // Need to invoke views::View in case any views whose bounds didn't change |
149 // still need a layout. | 149 // still need a layout. |
150 views::View::Layout(); | 150 views::View::Layout(); |
151 } | 151 } |
152 | 152 |
153 void ContentsContainer::CreateOverlay(int initial_opacity) { | 153 void ContentsContainer::CreateOverlay(int initial_opacity) { |
154 DCHECK(!active_overlay_); | 154 DCHECK(!active_overlay_); |
155 active_overlay_ = views::Widget::CreateWidget(); | |
156 active_overlay_->SetOpacity(initial_opacity); | |
157 gfx::Point screen_origin; | 155 gfx::Point screen_origin; |
158 views::View::ConvertPointToScreen(active_, &screen_origin); | 156 views::View::ConvertPointToScreen(active_, &screen_origin); |
159 gfx::Rect overlay_bounds(screen_origin, active_->size()); | 157 gfx::Rect overlay_bounds(screen_origin, active_->size()); |
160 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 158 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
161 params.transparent = true; | 159 params.transparent = true; |
162 params.accept_events = false; | 160 params.accept_events = false; |
163 params.parent = active_->GetWidget()->GetNativeView(); | 161 params.parent = active_->GetWidget()->GetNativeView(); |
164 params.bounds = overlay_bounds; | 162 params.bounds = overlay_bounds; |
| 163 active_overlay_ = new views::Widget; |
165 active_overlay_->Init(params); | 164 active_overlay_->Init(params); |
166 overlay_view_ = new OverlayContentView(this); | 165 overlay_view_ = new OverlayContentView(this); |
167 overlay_view_->set_background( | 166 overlay_view_->set_background( |
168 views::Background::CreateSolidBackground(SK_ColorWHITE)); | 167 views::Background::CreateSolidBackground(SK_ColorWHITE)); |
169 active_overlay_->SetContentsView(overlay_view_); | 168 active_overlay_->SetContentsView(overlay_view_); |
| 169 active_overlay_->SetOpacity(initial_opacity); |
170 active_overlay_->Show(); | 170 active_overlay_->Show(); |
171 active_overlay_->MoveAboveWidget(active_->GetWidget()); | 171 active_overlay_->MoveAboveWidget(active_->GetWidget()); |
172 } | 172 } |
173 | 173 |
174 void ContentsContainer::OverlayViewDestroyed() { | 174 void ContentsContainer::OverlayViewDestroyed() { |
175 active_overlay_ = NULL; | 175 active_overlay_ = NULL; |
176 overlay_view_ = NULL; | 176 overlay_view_ = NULL; |
177 } | 177 } |
OLD | NEW |