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_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/bubble_positioner.h" | 9 #include "chrome/browser/bubble_positioner.h" |
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 10 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
11 #include "chrome/browser/chromeos/compact_location_bar_host.h" | 11 #include "chrome/browser/chromeos/compact_location_bar_host.h" |
12 #include "chrome/browser/views/dropdown_bar_view.h" | 12 #include "chrome/browser/views/dropdown_bar_view.h" |
13 #include "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
14 #include "views/view.h" | 14 #include "views/view.h" |
15 | 15 |
16 class AutocompleteEditViewGtk; | 16 class AutocompleteEditViewGtk; |
17 class Browser; | 17 class Browser; |
18 class BrowserView; | 18 class BrowserView; |
19 class ToolbarStarToggleGtk; | 19 class ToolbarStarToggleGtk; |
20 class Tab; | 20 class Tab; |
21 class TabContents; | 21 class TabContents; |
22 class TabStrip; | 22 class TabStrip; |
| 23 class ToolbarStarToggle; |
23 | 24 |
24 namespace views { | 25 namespace views { |
25 class ImageButton; | 26 class ImageButton; |
26 class NativeViewHost; | 27 class NativeViewHost; |
27 } // namespace views | 28 } // namespace views |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 // CompactLocationBarView is a version of location bar that is shown under | 32 // CompactLocationBarView is a version of location bar that is shown under |
32 // a tab for short priod of used when Chrome is in the compact | 33 // a tab for short priod of used when Chrome is in the compact |
33 // navigation bar mode. | 34 // navigation bar mode. |
34 class CompactLocationBarView : public DropdownBarView, | 35 class CompactLocationBarView : public DropdownBarView, |
35 public views::ButtonListener, | 36 public views::ButtonListener, |
36 public AutocompleteEditController, | 37 public AutocompleteEditController, |
37 public BubblePositioner { | 38 public BubblePositioner, |
| 39 public views::DragController { |
38 public: | 40 public: |
39 explicit CompactLocationBarView(CompactLocationBarHost* host); | 41 explicit CompactLocationBarView(CompactLocationBarHost* host); |
40 ~CompactLocationBarView(); | 42 ~CompactLocationBarView(); |
41 | 43 |
42 // Claims focus for the text field and selects its contents. | 44 // Claims focus for the text field and selects its contents. |
43 virtual void SetFocusAndSelection(); | 45 virtual void SetFocusAndSelection(); |
44 | 46 |
45 void Update(const TabContents* contents); | 47 void Update(const TabContents* contents); |
46 | 48 |
| 49 ToolbarStarToggle* star_button() const { return star_; } |
| 50 |
47 private: | 51 private: |
48 Browser* browser() const; | 52 Browser* browser() const; |
49 | 53 |
50 // Called when the view is added to the tree to initialize the | 54 // Called when the view is added to the tree to initialize the |
51 // CompactLocationBarView. | 55 // CompactLocationBarView. |
52 void Init(); | 56 void Init(); |
53 | 57 |
54 // Overridden from views::View. | 58 // Overridden from views::View. |
55 virtual gfx::Size GetPreferredSize(); | 59 virtual gfx::Size GetPreferredSize(); |
56 virtual void Layout(); | 60 virtual void Layout(); |
(...skipping 13 matching lines...) Expand all Loading... |
70 virtual void OnChanged(); | 74 virtual void OnChanged(); |
71 virtual void OnKillFocus(); | 75 virtual void OnKillFocus(); |
72 virtual void OnSetFocus(); | 76 virtual void OnSetFocus(); |
73 virtual void OnInputInProgress(bool in_progress); | 77 virtual void OnInputInProgress(bool in_progress); |
74 virtual SkBitmap GetFavIcon() const; | 78 virtual SkBitmap GetFavIcon() const; |
75 virtual std::wstring GetTitle() const; | 79 virtual std::wstring GetTitle() const; |
76 | 80 |
77 // BubblePositioner implementation. | 81 // BubblePositioner implementation. |
78 virtual gfx::Rect GetLocationStackBounds() const; | 82 virtual gfx::Rect GetLocationStackBounds() const; |
79 | 83 |
| 84 // views::DragController implementation. |
| 85 virtual void WriteDragData(View* sender, |
| 86 int press_x, |
| 87 int press_y, |
| 88 OSExchangeData* data); |
| 89 virtual int GetDragOperations(View* sender, int x, int y); |
| 90 virtual bool CanStartDrag(View* sender, |
| 91 int press_x, |
| 92 int press_y, |
| 93 int x, |
| 94 int y) { |
| 95 return true; |
| 96 } |
| 97 |
80 CompactLocationBarHost* clb_host() { | 98 CompactLocationBarHost* clb_host() { |
81 return static_cast<CompactLocationBarHost*>(host()); | 99 return static_cast<CompactLocationBarHost*>(host()); |
82 } | 100 } |
83 | 101 |
84 views::ImageButton* reload_; | 102 views::ImageButton* reload_; |
85 scoped_ptr<AutocompleteEditViewGtk> location_entry_; | 103 scoped_ptr<AutocompleteEditViewGtk> location_entry_; |
86 views::NativeViewHost* location_entry_view_; | 104 views::NativeViewHost* location_entry_view_; |
87 | 105 |
88 // scoped_ptr<ToolbarStarToggleGtk> star_; | 106 ToolbarStarToggle* star_; |
89 views::NativeViewHost* star_view_; | |
90 | 107 |
91 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView); | 108 DISALLOW_COPY_AND_ASSIGN(CompactLocationBarView); |
92 }; | 109 }; |
93 | 110 |
94 } // namespace chromeos | 111 } // namespace chromeos |
95 | 112 |
96 #endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ | 113 #endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_ |
OLD | NEW |