Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_container_aura.cc

Issue 10907038: alternate ntp: clip middle omnibox when resizing browser window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed david's comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Allows clipping of children.
sky 2012/09/13 19:58:24 This comment duplicates what the code is doing. In
kuan 2012/09/13 20:13:28 Done.
17 layer()->SetMasksToBounds(true);
16 StackAtTop(); 18 StackAtTop();
17 } 19 }
18 } 20 }
19 21
20 void LocationBarContainer::OnFocus() { 22 void LocationBarContainer::OnFocus() {
21 } 23 }
22 24
23 void LocationBarContainer::PlatformInit() { 25 void LocationBarContainer::PlatformInit() {
24 view_parent_ = this; 26 view_parent_ = this;
25 // Ideally we would turn on layer painting here, but this poses problems with 27 // 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 28 // infobar arrows. So, instead we turn on the layer when animating and turn it
27 // off when done. 29 // off when done.
28 } 30 }
29 31
30 // static 32 // static
31 SkColor LocationBarContainer::GetBackgroundColor() { 33 SkColor LocationBarContainer::GetBackgroundColor() {
32 return instant_extended_api_enabled_ ? 34 return instant_extended_api_enabled_ ?
33 SK_ColorWHITE : 35 SK_ColorWHITE :
34 LocationBarView::kOmniboxBackgroundColor; 36 LocationBarView::kOmniboxBackgroundColor;
35 } 37 }
36 38
37 void LocationBarContainer::StackAtTop() { 39 void LocationBarContainer::StackAtTop() {
38 // TODO: this is hack. The problem is NativeViewHostAura does an AddChild(), 40 // TODO: this is hack. The problem is NativeViewHostAura does an AddChild(),
39 // which places its layer at the top of the stack. 41 // which places its layer at the top of the stack.
40 if (layer()) 42 if (layer())
41 layer()->parent()->StackAtTop(layer()); 43 layer()->parent()->StackAtTop(layer());
42 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698