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

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

Issue 10854017: Basic metro snap view omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos compilation. Created 8 years, 4 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 #include "chrome/browser/ui/webui/instant_ui.h" 8 #include "chrome/browser/ui/webui/instant_ui.h"
9 #include "ui/base/event.h" 9 #include "ui/base/event.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 20 matching lines...) Expand all
31 view_parent_->set_background( 31 view_parent_->set_background(
32 views::Background::CreateSolidBackground(GetBackgroundColor())); 32 views::Background::CreateSolidBackground(GetBackgroundColor()));
33 } 33 }
34 SetLayoutManager(new views::FillLayout); 34 SetLayoutManager(new views::FillLayout);
35 } 35 }
36 36
37 LocationBarContainer::~LocationBarContainer() { 37 LocationBarContainer::~LocationBarContainer() {
38 } 38 }
39 39
40 void LocationBarContainer::SetLocationBarView(LocationBarView* view) { 40 void LocationBarContainer::SetLocationBarView(LocationBarView* view) {
41 DCHECK(!location_bar_view_ && view); 41 DCHECK(view);
42
43 if (location_bar_view_) {
44 view_parent_->RemoveChildView(location_bar_view_);
45 }
46
42 location_bar_view_ = view; 47 location_bar_view_ = view;
43 view_parent_->AddChildView(location_bar_view_); 48 view_parent_->AddChildView(location_bar_view_);
44 DCHECK_EQ(1, view_parent_->child_count()); // Only support one child. 49 DCHECK_EQ(1, view_parent_->child_count()); // Only support one child.
45 } 50 }
46 51
47 void LocationBarContainer::AnimateTo(const gfx::Rect& bounds) { 52 void LocationBarContainer::AnimateTo(const gfx::Rect& bounds) {
48 // Animation duration can change during session. 53 // Animation duration can change during session.
49 animator_.SetAnimationDuration(GetAnimationDuration()); 54 animator_.SetAnimationDuration(GetAnimationDuration());
50 animator_.AnimateViewTo(this, bounds); 55 animator_.AnimateViewTo(this, bounds);
51 } 56 }
(...skipping 26 matching lines...) Expand all
78 83
79 void LocationBarContainer::OnBoundsAnimatorDone( 84 void LocationBarContainer::OnBoundsAnimatorDone(
80 views::BoundsAnimator* animator) { 85 views::BoundsAnimator* animator) {
81 SetInToolbar(true); 86 SetInToolbar(true);
82 } 87 }
83 88
84 // static 89 // static
85 int LocationBarContainer::GetAnimationDuration() { 90 int LocationBarContainer::GetAnimationDuration() {
86 return kAnimationDuration * InstantUI::GetSlowAnimationScaleFactor(); 91 return kAnimationDuration * InstantUI::GetSlowAnimationScaleFactor();
87 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698