| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/location_bar/location_bar_container.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_container.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 8 | 8 |
| 9 void LocationBarContainer::SetInToolbar(bool in_toolbar) { | 9 void LocationBarContainer::SetInToolbar(bool in_toolbar) { |
| 10 if (animator_.IsAnimating()) | 10 if (animator_.IsAnimating()) |
| 11 animator_.Cancel(); | 11 animator_.Cancel(); |
| 12 // See comment in PlatformInit() as to why we do this. | 12 // See comment in PlatformInit() as to why we do this. |
| 13 SetPaintToLayer(!in_toolbar); | 13 SetPaintToLayer(!in_toolbar); |
| 14 if (!in_toolbar) { | 14 if (!in_toolbar) { |
| 15 layer()->SetFillsBoundsOpaquely(false); | 15 layer()->SetFillsBoundsOpaquely(false); |
| 16 // The LocationBarView may be taller than us (otherwise the text gets |
| 17 // squished in weird ways). To allow the LocationBarView to be taller yet |
| 18 // clipped to our bounds, we explicity turn on clipping. |
| 19 layer()->SetMasksToBounds(true); |
| 16 StackAtTop(); | 20 StackAtTop(); |
| 17 } | 21 } |
| 18 } | 22 } |
| 19 | 23 |
| 20 void LocationBarContainer::OnFocus() { | 24 void LocationBarContainer::OnFocus() { |
| 21 } | 25 } |
| 22 | 26 |
| 23 void LocationBarContainer::PlatformInit() { | 27 void LocationBarContainer::PlatformInit() { |
| 24 view_parent_ = this; | 28 view_parent_ = this; |
| 25 // Ideally we would turn on layer painting here, but this poses problems with | 29 // Ideally we would turn on layer painting here, but this poses problems with |
| 26 // infobar arrows. So, instead we turn on the layer when animating and turn it | 30 // infobar arrows. So, instead we turn on the layer when animating and turn it |
| 27 // off when done. | 31 // off when done. |
| 28 } | 32 } |
| 29 | 33 |
| 30 // static | 34 // static |
| 31 SkColor LocationBarContainer::GetBackgroundColor() { | 35 SkColor LocationBarContainer::GetBackgroundColor() { |
| 32 return instant_extended_api_enabled_ ? | 36 return instant_extended_api_enabled_ ? |
| 33 SK_ColorWHITE : | 37 SK_ColorWHITE : |
| 34 LocationBarView::kOmniboxBackgroundColor; | 38 LocationBarView::kOmniboxBackgroundColor; |
| 35 } | 39 } |
| 36 | 40 |
| 37 void LocationBarContainer::StackAtTop() { | 41 void LocationBarContainer::StackAtTop() { |
| 38 // TODO: this is hack. The problem is NativeViewHostAura does an AddChild(), | 42 // TODO: this is hack. The problem is NativeViewHostAura does an AddChild(), |
| 39 // which places its layer at the top of the stack. | 43 // which places its layer at the top of the stack. |
| 40 if (layer()) | 44 if (layer()) |
| 41 layer()->parent()->StackAtTop(layer()); | 45 layer()->parent()->StackAtTop(layer()); |
| 42 } | 46 } |
| OLD | NEW |