OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ |
6 #define CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
11 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 11 #include "chrome/browser/bubble_positioner.h" |
12 #include "views/controls/button/button.h" | 12 #include "views/controls/button/button.h" |
13 #include "views/view.h" | 13 #include "views/view.h" |
14 | 14 |
15 class AutocompleteEditViewGtk; | 15 class AutocompleteEditViewGtk; |
16 class Browser; | 16 class Browser; |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 class ImageButton; | 19 class ImageButton; |
20 class ImageView; | 20 class ImageView; |
21 class NativeViewHost; | 21 class NativeViewHost; |
22 } | 22 } |
23 | 23 |
24 // This class provides a small navigation bar that includes back, forward, and | 24 // This class provides a small navigation bar that includes back, forward, and |
25 // a small text entry box. | 25 // a small text entry box. |
26 class CompactNavigationBar : public views::View, | 26 class CompactNavigationBar : public views::View, |
27 public views::ButtonListener, | 27 public views::ButtonListener, |
28 public AutocompleteEditController, | 28 public AutocompleteEditController, |
29 public AutocompletePopupPositioner { | 29 public BubblePositioner { |
30 public: | 30 public: |
31 explicit CompactNavigationBar(Browser* browser); | 31 explicit CompactNavigationBar(Browser* browser); |
32 virtual ~CompactNavigationBar(); | 32 virtual ~CompactNavigationBar(); |
33 | 33 |
34 // Must be called before anything else, but after adding this view to the | 34 // Must be called before anything else, but after adding this view to the |
35 // widget. | 35 // widget. |
36 void Init(); | 36 void Init(); |
37 | 37 |
38 // views::View overrides. | 38 // views::View overrides. |
39 virtual gfx::Size GetPreferredSize(); | 39 virtual gfx::Size GetPreferredSize(); |
40 virtual void Layout(); | 40 virtual void Layout(); |
41 virtual void Paint(gfx::Canvas* canvas); | 41 virtual void Paint(gfx::Canvas* canvas); |
42 | 42 |
43 private: | 43 private: |
44 // views::ButtonListener implementation. | 44 // views::ButtonListener implementation. |
45 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 45 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
46 | 46 |
47 // AutocompleteController implementation. | 47 // AutocompleteController implementation. |
48 virtual void OnAutocompleteAccept(const GURL& url, | 48 virtual void OnAutocompleteAccept(const GURL& url, |
49 WindowOpenDisposition disposition, | 49 WindowOpenDisposition disposition, |
50 PageTransition::Type transition, | 50 PageTransition::Type transition, |
51 const GURL& alternate_nav_url); | 51 const GURL& alternate_nav_url); |
52 virtual void OnChanged(); | 52 virtual void OnChanged(); |
53 virtual void OnInputInProgress(bool in_progress); | 53 virtual void OnInputInProgress(bool in_progress); |
54 virtual void OnSetFocus(); | 54 virtual void OnSetFocus(); |
55 virtual SkBitmap GetFavIcon() const; | 55 virtual SkBitmap GetFavIcon() const; |
56 virtual std::wstring GetTitle() const; | 56 virtual std::wstring GetTitle() const; |
57 | 57 |
58 // AutocompletePopupPositioner implementation. | 58 // BubblePositioner: |
59 virtual gfx::Rect GetPopupBounds() const; | 59 virtual gfx::Rect GetLocationStackBounds() const; |
60 | 60 |
61 void AddTabWithURL(const GURL& url, PageTransition::Type transition); | 61 void AddTabWithURL(const GURL& url, PageTransition::Type transition); |
62 | 62 |
63 Browser* browser_; | 63 Browser* browser_; |
64 | 64 |
65 bool initialized_; | 65 bool initialized_; |
66 | 66 |
67 views::ImageButton* chrome_button_; | 67 views::ImageButton* chrome_button_; |
68 | 68 |
69 views::ImageButton* back_button_; | 69 views::ImageButton* back_button_; |
70 views::ImageView* bf_separator_; | 70 views::ImageView* bf_separator_; |
71 views::ImageButton* forward_button_; | 71 views::ImageButton* forward_button_; |
72 | 72 |
73 scoped_ptr<AutocompleteEditViewGtk> location_entry_; | 73 scoped_ptr<AutocompleteEditViewGtk> location_entry_; |
74 views::NativeViewHost* location_entry_view_; | 74 views::NativeViewHost* location_entry_view_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(CompactNavigationBar); | 76 DISALLOW_COPY_AND_ASSIGN(CompactNavigationBar); |
77 }; | 77 }; |
78 | 78 |
79 #endif // CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ | 79 #endif // CHROME_BROWSER_CHROMEOS_COMPACT_NAVIGATION_BAR_H_ |
OLD | NEW |