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

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 scott'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 // 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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_container.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698