| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_ |
| 7 |
| 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/views/view.h" |
| 10 #include "ui/views/animation/bounds_animator.h" |
| 11 #include "ui/views/animation/bounds_animator_observer.h" |
| 12 |
| 13 class LocationBarView; |
| 14 |
| 15 namespace views { |
| 16 class NativeViewHost; |
| 17 } |
| 18 |
| 19 // LocationBarContainer contains the LocationBarView. Under aura it directly |
| 20 // contains the LocationBarView, on windows an intermediary widget is used. The |
| 21 // intermediary widget is used so that LocationBarContainer can be placed on top |
| 22 // of other native views (such as web content). |
| 23 // LocationBarContainer is positioned by ToolbarView, but it is a child of |
| 24 // BrowserView. This is used when on the NTP. |
| 25 class LocationBarContainer : public views::View, |
| 26 public views::BoundsAnimatorObserver { |
| 27 public: |
| 28 // Creates a new LocationBarContainer as a child of |parent|. |
| 29 explicit LocationBarContainer(views::View* parent); |
| 30 virtual ~LocationBarContainer(); |
| 31 |
| 32 void SetLocationBarView(LocationBarView* view); |
| 33 |
| 34 // Stacks this view at the top. More specifically stacks the layer (aura) |
| 35 // or widget (windows) at the top of the stack. Used to ensure this is over |
| 36 // web contents. |
| 37 void StackAtTop(); |
| 38 |
| 39 // Animates to the specified position. |
| 40 void AnimateTo(const gfx::Rect& bounds); |
| 41 |
| 42 // Returns true if animating. |
| 43 bool IsAnimating() const; |
| 44 |
| 45 // Returns the target bounds if animating, or the actual bounds if not |
| 46 // animating. |
| 47 gfx::Rect GetTargetBounds(); |
| 48 |
| 49 // views::View overrides: |
| 50 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 51 virtual bool SkipDefaultKeyEventProcessing( |
| 52 const views::KeyEvent& event) OVERRIDE; |
| 53 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 54 |
| 55 // views::BoundsAnimator overrides: |
| 56 virtual void OnBoundsAnimatorProgressed( |
| 57 views::BoundsAnimator* animator) OVERRIDE {} |
| 58 virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; |
| 59 |
| 60 protected: |
| 61 virtual void OnFocus() OVERRIDE; |
| 62 |
| 63 private: |
| 64 // Sets up platform specific state. |
| 65 void PlatformInit(); |
| 66 |
| 67 // Returns the background color. |
| 68 static SkColor GetBackgroundColor(); |
| 69 |
| 70 // Used to animate this view. |
| 71 views::BoundsAnimator animator_; |
| 72 |
| 73 // Parent the LocationBarView is added to. |
| 74 views::View* view_parent_; |
| 75 |
| 76 LocationBarView* location_bar_view_; |
| 77 |
| 78 views::NativeViewHost* native_view_host_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(LocationBarContainer); |
| 81 }; |
| 82 |
| 83 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_ |
| OLD | NEW |