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

Unified Diff: chrome/browser/ui/views/compact_nav/compact_location_bar_view.h

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 8 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/compact_nav/compact_location_bar_view.h
diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view.h b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.h
new file mode 100755
index 0000000000000000000000000000000000000000..ef57c30acbc47bec6a6ae7b546f890df017cdc29
--- /dev/null
+++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2011 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_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_
+
+#include "base/basictypes.h"
+#include "chrome/browser/autocomplete/autocomplete_edit.h"
+#include "chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h"
sky 2011/05/03 18:38:32 Is compact_location_bar_view_host needed in the he
SteveT 2011/05/06 18:48:43 The clb_host() accessor below complains unless the
+#include "chrome/browser/ui/views/dropdown_bar_view.h"
+#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
sky 2011/05/03 18:38:32 Is this needed?
SteveT 2011/05/06 18:48:43 Done.
+#include "chrome/browser/ui/views/reload_button.h"
sky 2011/05/03 18:38:32 forward declare ReloadButton
SteveT 2011/05/06 18:48:43 Done.
+#include "views/controls/button/button.h"
+#include "views/view.h"
+
+#if defined(OS_WIN)
sky 2011/05/03 18:38:32 Do you really need these includes here?
SteveT 2011/05/06 18:48:43 No - I guess we originally needed it here but even
+#include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
+#elif defined(OS_LINUX)
sky 2011/05/03 18:38:32 TOOLKIT_USES_GTK
SteveT 2011/05/06 18:48:43 Done.
+#include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
+#endif
+
+class Browser;
+class BrowserView;
+class LocationBarView;
+class TabContents;
+
+namespace views {
+class ImageButton;
+class NativeViewHost;
+} // namespace views
+
+// CompactLocationBarView is a version of location bar that is shown under
+// a tab for short period of used when Chrome is in the compact
sky 2011/05/03 18:38:32 'short period of used' -> 'short period of time'
SteveT 2011/05/06 18:48:43 Done.
+// navigation bar mode.
+class CompactLocationBarView : public DropdownBarView,
+ public views::ButtonListener,
+ public AutocompleteEditController {
+ public:
+ explicit CompactLocationBarView(CompactLocationBarViewHost* host);
+ ~CompactLocationBarView();
+
+ // Overridden from AccessiblePaneView
+ virtual bool SetPaneFocus(int view_storage_id, View* initial_focus) OVERRIDE;
+ virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
+
+ // Claims focus for the text field and optionally selects its contents.
+ virtual void SetFocusAndSelection(bool select_all);
sky 2011/05/03 18:38:32 OVERRIDE, and document this is from DropdownBarVie
SteveT 2011/05/06 18:48:43 This is actually not from DropdownBarView and just
+
+ void Update(const TabContents* contents);
sky 2011/05/03 18:38:32 Description?
SteveT 2011/05/06 18:48:43 Done.
+
+ LocationBarView* location_bar_view() { return location_bar_view_; }
+ ReloadButton* reload_button() { return reload_button_; }
+
+ private:
+ Browser* browser() const;
+
+ // Called when the view is added to the tree to initialize the
+ // CompactLocationBarView.
+ void Init();
+
+ // Overridden from views::View.
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas);
+ virtual void Layout() OVERRIDE;
+ virtual void Paint(gfx::Canvas* canvas) OVERRIDE;
+ virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
+ views::View* child) OVERRIDE;
+
+ // No focus border for the location bar, the caret is enough.
+ virtual void Focus();
+ virtual void PaintFocusBorder(gfx::Canvas* canvas) { }
+
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) OVERRIDE;
+
+ // AutocompleteEditController implementation.
+ virtual void OnAutocompleteAccept(const GURL& url,
+ WindowOpenDisposition disposition,
+ PageTransition::Type transition,
+ const GURL& alternate_nav_url) OVERRIDE;
+ virtual void OnChanged() OVERRIDE;
+ virtual void OnSelectionBoundsChanged() OVERRIDE;
+ virtual void OnKillFocus() OVERRIDE;
+ virtual void OnSetFocus() OVERRIDE;
+ virtual SkBitmap GetFavicon() const OVERRIDE;
+ virtual void OnInputInProgress(bool in_progress) OVERRIDE;
+ virtual string16 GetTitle() const OVERRIDE;
+ virtual InstantController* GetInstant() OVERRIDE;
+ virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE;
+
+ CompactLocationBarViewHost* clb_host() {
+ return static_cast<CompactLocationBarViewHost*>(host());
+ }
+
+ ReloadButton* reload_button_;
+ LocationBarView* location_bar_view_;
+ // TODO(stevet): Add the BrowserActionsContainer back.
+
+ // Font used by edit and some of the hints.
+ gfx::Font font_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698