Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | |
| 10 #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
| |
| 11 #include "chrome/browser/ui/views/dropdown_bar_view.h" | |
| 12 #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.
| |
| 13 #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.
| |
| 14 #include "views/controls/button/button.h" | |
| 15 #include "views/view.h" | |
| 16 | |
| 17 #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
| |
| 18 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | |
| 19 #elif defined(OS_LINUX) | |
|
sky
2011/05/03 18:38:32
TOOLKIT_USES_GTK
SteveT
2011/05/06 18:48:43
Done.
| |
| 20 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | |
| 21 #endif | |
| 22 | |
| 23 class Browser; | |
| 24 class BrowserView; | |
| 25 class LocationBarView; | |
| 26 class TabContents; | |
| 27 | |
| 28 namespace views { | |
| 29 class ImageButton; | |
| 30 class NativeViewHost; | |
| 31 } // namespace views | |
| 32 | |
| 33 // CompactLocationBarView is a version of location bar that is shown under | |
| 34 // 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.
| |
| 35 // navigation bar mode. | |
| 36 class CompactLocationBarView : public DropdownBarView, | |
| 37 public views::ButtonListener, | |
| 38 public AutocompleteEditController { | |
| 39 public: | |
| 40 explicit CompactLocationBarView(CompactLocationBarViewHost* host); | |
| 41 ~CompactLocationBarView(); | |
| 42 | |
| 43 // Overridden from AccessiblePaneView | |
| 44 virtual bool SetPaneFocus(int view_storage_id, View* initial_focus) OVERRIDE; | |
| 45 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | |
| 46 | |
| 47 // Claims focus for the text field and optionally selects its contents. | |
| 48 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
| |
| 49 | |
| 50 void Update(const TabContents* contents); | |
|
sky
2011/05/03 18:38:32
Description?
SteveT
2011/05/06 18:48:43
Done.
| |
| 51 | |
| 52 LocationBarView* location_bar_view() { return location_bar_view_; } | |
| 53 ReloadButton* reload_button() { return reload_button_; } | |
| 54 | |
| 55 private: | |
| 56 Browser* browser() const; | |
| 57 | |
| 58 // Called when the view is added to the tree to initialize the | |
| 59 // CompactLocationBarView. | |
| 60 void Init(); | |
| 61 | |
| 62 // Overridden from views::View. | |
| 63 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 64 virtual void OnPaint(gfx::Canvas* canvas); | |
| 65 virtual void Layout() OVERRIDE; | |
| 66 virtual void Paint(gfx::Canvas* canvas) OVERRIDE; | |
| 67 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, | |
| 68 views::View* child) OVERRIDE; | |
| 69 | |
| 70 // No focus border for the location bar, the caret is enough. | |
| 71 virtual void Focus(); | |
| 72 virtual void PaintFocusBorder(gfx::Canvas* canvas) { } | |
| 73 | |
| 74 // Overridden from views::ButtonListener: | |
| 75 virtual void ButtonPressed(views::Button* sender, | |
| 76 const views::Event& event) OVERRIDE; | |
| 77 | |
| 78 // AutocompleteEditController implementation. | |
| 79 virtual void OnAutocompleteAccept(const GURL& url, | |
| 80 WindowOpenDisposition disposition, | |
| 81 PageTransition::Type transition, | |
| 82 const GURL& alternate_nav_url) OVERRIDE; | |
| 83 virtual void OnChanged() OVERRIDE; | |
| 84 virtual void OnSelectionBoundsChanged() OVERRIDE; | |
| 85 virtual void OnKillFocus() OVERRIDE; | |
| 86 virtual void OnSetFocus() OVERRIDE; | |
| 87 virtual SkBitmap GetFavicon() const OVERRIDE; | |
| 88 virtual void OnInputInProgress(bool in_progress) OVERRIDE; | |
| 89 virtual string16 GetTitle() const OVERRIDE; | |
| 90 virtual InstantController* GetInstant() OVERRIDE; | |
| 91 virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE; | |
| 92 | |
| 93 CompactLocationBarViewHost* clb_host() { | |
| 94 return static_cast<CompactLocationBarViewHost*>(host()); | |
| 95 } | |
| 96 | |
| 97 ReloadButton* reload_button_; | |
| 98 LocationBarView* location_bar_view_; | |
| 99 // TODO(stevet): Add the BrowserActionsContainer back. | |
| 100 | |
| 101 // Font used by edit and some of the hints. | |
| 102 gfx::Font font_; | |
| 103 | |
| 104 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView); | |
| 105 }; | |
| 106 | |
| 107 #endif // CHROME_BROWSER_UI_VIEWS_COMPACT_NAV_COMPACT_LOCATION_BAR_VIEW_H_ | |
| OLD | NEW |