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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_container.h

Issue 10630013: Adds LocationBarContainer that contains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove set_view_to_focus Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_container.h
diff --git a/chrome/browser/ui/views/location_bar/location_bar_container.h b/chrome/browser/ui/views/location_bar/location_bar_container.h
new file mode 100644
index 0000000000000000000000000000000000000000..03322341acc3c305b72309f5ccab440109694ebc
--- /dev/null
+++ b/chrome/browser/ui/views/location_bar/location_bar_container.h
@@ -0,0 +1,83 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_
+#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/views/view.h"
+#include "ui/views/animation/bounds_animator.h"
+#include "ui/views/animation/bounds_animator_observer.h"
+
+class LocationBarView;
+
+namespace views {
+class NativeViewHost;
+}
+
+// LocationBarContainer contains the LocationBarView. Under aura it directly
+// contains the LocationBarView, on windows an intermediary widget is used. The
+// intermediary widget is used so that LocationBarContainer can be placed on top
+// of other native views (such as web content).
+// LocationBarContainer is positioned by ToolbarView, but it is a child of
+// BrowserView. This is used when on the NTP.
+class LocationBarContainer : public views::View,
+ public views::BoundsAnimatorObserver {
+ public:
+ // Creates a new LocationBarContainer as a child of |parent|.
+ explicit LocationBarContainer(views::View* parent);
+ virtual ~LocationBarContainer();
+
+ void SetLocationBarView(LocationBarView* view);
+
+ // Stacks this view at the top. More specifically stacks the layer (aura)
+ // or widget (windows) at the top of the stack. Used to ensure this is over
+ // web contents.
+ void StackAtTop();
+
+ // Animates to the specified position.
+ void AnimateTo(const gfx::Rect& bounds);
+
+ // Returns true if animating.
+ bool IsAnimating() const;
+
+ // Returns the target bounds if animating, or the actual bounds if not
+ // animating.
+ gfx::Rect GetTargetBounds();
+
+ // views::View overrides:
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual bool SkipDefaultKeyEventProcessing(
+ const views::KeyEvent& event) OVERRIDE;
+ virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+
+ // views::BoundsAnimator overrides:
+ virtual void OnBoundsAnimatorProgressed(
+ views::BoundsAnimator* animator) OVERRIDE {}
+ virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE;
+
+ protected:
+ virtual void OnFocus() OVERRIDE;
+
+ private:
+ // Sets up platform specific state.
+ void PlatformInit();
+
+ // Returns the background color.
+ static SkColor GetBackgroundColor();
+
+ // Used to animate this view.
+ views::BoundsAnimator animator_;
+
+ // Parent the LocationBarView is added to.
+ views::View* view_parent_;
+
+ LocationBarView* location_bar_view_;
+
+ views::NativeViewHost* native_view_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(LocationBarContainer);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_CONTAINER_H_
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698