OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/prefs/pref_member.h" | 12 #include "base/prefs/pref_member.h" |
13 #include "chrome/browser/extensions/extension_context_menu_model.h" | 13 #include "chrome/browser/extensions/extension_context_menu_model.h" |
14 #include "chrome/browser/search_engines/template_url_service_observer.h" | 14 #include "chrome/browser/search_engines/template_url_service_observer.h" |
15 #include "chrome/browser/ui/omnibox/location_bar.h" | 15 #include "chrome/browser/ui/omnibox/location_bar.h" |
16 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 16 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
17 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 17 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
18 #include "chrome/browser/ui/views/dropdown_bar_host.h" | 18 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
19 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" | 19 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" |
20 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 20 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 21 #include "chrome/browser/ui/views/omnibox/omnibox_view_delegate.h" |
21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
23 #include "ui/gfx/font.h" | 24 #include "ui/gfx/font.h" |
24 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
25 #include "ui/views/controls/native/native_view_host.h" | 26 #include "ui/views/controls/native/native_view_host.h" |
26 #include "ui/views/drag_controller.h" | 27 #include "ui/views/drag_controller.h" |
27 | 28 |
28 #if defined(USE_AURA) | 29 #if defined(USE_AURA) |
29 #include "ui/compositor/layer_animation_observer.h" | 30 #include "ui/compositor/layer_animation_observer.h" |
30 #endif | 31 #endif |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // | 63 // |
63 // The LocationBarView class is a View subclass that paints the background | 64 // The LocationBarView class is a View subclass that paints the background |
64 // of the URL bar strip and contains its content. | 65 // of the URL bar strip and contains its content. |
65 // | 66 // |
66 ///////////////////////////////////////////////////////////////////////////// | 67 ///////////////////////////////////////////////////////////////////////////// |
67 class LocationBarView : public LocationBar, | 68 class LocationBarView : public LocationBar, |
68 public LocationBarTesting, | 69 public LocationBarTesting, |
69 public views::View, | 70 public views::View, |
70 public views::DragController, | 71 public views::DragController, |
71 public OmniboxEditController, | 72 public OmniboxEditController, |
| 73 public OmniboxViewDelegate, |
72 public DropdownBarHostDelegate, | 74 public DropdownBarHostDelegate, |
73 public TemplateURLServiceObserver, | 75 public TemplateURLServiceObserver, |
74 public content::NotificationObserver { | 76 public content::NotificationObserver { |
75 public: | 77 public: |
76 // The location bar view's class name. | 78 // The location bar view's class name. |
77 static const char kViewClassName[]; | 79 static const char kViewClassName[]; |
78 | 80 |
79 // DropdownBarHostDelegate: | 81 // DropdownBarHostDelegate: |
80 virtual void SetFocusAndSelection(bool select_all) OVERRIDE; | 82 virtual void SetFocusAndSelection(bool select_all) OVERRIDE; |
81 virtual void SetAnimationOffset(int offset) OVERRIDE; | 83 virtual void SetAnimationOffset(int offset) OVERRIDE; |
82 | 84 |
83 // Returns the offset used while animating. | 85 // Returns the offset used while animating. |
84 int animation_offset() const { return animation_offset_; } | 86 int animation_offset() const { return animation_offset_; } |
85 | 87 |
86 class Delegate { | 88 class Delegate { |
87 public: | 89 public: |
88 // Should return the current web contents. | 90 // Should return the current web contents. |
89 virtual content::WebContents* GetWebContents() const = 0; | 91 virtual content::WebContents* GetWebContents() const = 0; |
90 | 92 |
91 // Returns the InstantController, or NULL if there isn't one. | 93 // Returns the InstantController, or NULL if there isn't one. |
92 virtual InstantController* GetInstant() = 0; | 94 virtual InstantController* GetInstant() = 0; |
93 | 95 |
| 96 // Returns the position and width that the popup should be, and also the |
| 97 // left edge that the results should align themselves to (which will leave |
| 98 // some border on the left of the popup). |
| 99 virtual void GetOmniboxPopupPositioningInfo( |
| 100 gfx::Point* top_left_screen_coord, |
| 101 int* popup_width, |
| 102 int* left_margin, |
| 103 int* right_margin) = 0; |
| 104 |
94 // Creates Widget for the given delegate. | 105 // Creates Widget for the given delegate. |
95 virtual views::Widget* CreateViewsBubble( | 106 virtual views::Widget* CreateViewsBubble( |
96 views::BubbleDelegateView* bubble_delegate) = 0; | 107 views::BubbleDelegateView* bubble_delegate) = 0; |
97 | 108 |
98 // Creates PageActionImageView. Caller gets an ownership. | 109 // Creates PageActionImageView. Caller gets an ownership. |
99 virtual PageActionImageView* CreatePageActionImageView( | 110 virtual PageActionImageView* CreatePageActionImageView( |
100 LocationBarView* owner, | 111 LocationBarView* owner, |
101 ExtensionAction* action) = 0; | 112 ExtensionAction* action) = 0; |
102 | 113 |
103 // Returns ContentSettingBubbleModelDelegate. | 114 // Returns ContentSettingBubbleModelDelegate. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 virtual void OnChanged() OVERRIDE; | 258 virtual void OnChanged() OVERRIDE; |
248 virtual void OnSelectionBoundsChanged() OVERRIDE; | 259 virtual void OnSelectionBoundsChanged() OVERRIDE; |
249 virtual void OnInputInProgress(bool in_progress) OVERRIDE; | 260 virtual void OnInputInProgress(bool in_progress) OVERRIDE; |
250 virtual void OnKillFocus() OVERRIDE; | 261 virtual void OnKillFocus() OVERRIDE; |
251 virtual void OnSetFocus() OVERRIDE; | 262 virtual void OnSetFocus() OVERRIDE; |
252 virtual gfx::Image GetFavicon() const OVERRIDE; | 263 virtual gfx::Image GetFavicon() const OVERRIDE; |
253 virtual string16 GetTitle() const OVERRIDE; | 264 virtual string16 GetTitle() const OVERRIDE; |
254 virtual InstantController* GetInstant() OVERRIDE; | 265 virtual InstantController* GetInstant() OVERRIDE; |
255 virtual content::WebContents* GetWebContents() const OVERRIDE; | 266 virtual content::WebContents* GetWebContents() const OVERRIDE; |
256 | 267 |
| 268 // OmniboxViewDelegate: |
| 269 virtual void GetPopupPositioningInfo(gfx::Point* top_left_screen_coord, |
| 270 int* popup_width, |
| 271 int* left_margin, |
| 272 int* right_margin) OVERRIDE; |
| 273 virtual ui::ThemeProvider* GetThemeProviderForPopup() OVERRIDE; |
| 274 virtual gfx::NativeView GetPopupParent() OVERRIDE; |
| 275 |
257 // views::View: | 276 // views::View: |
258 virtual const char* GetClassName() const OVERRIDE; | 277 virtual const char* GetClassName() const OVERRIDE; |
259 virtual bool SkipDefaultKeyEventProcessing( | 278 virtual bool SkipDefaultKeyEventProcessing( |
260 const ui::KeyEvent& event) OVERRIDE; | 279 const ui::KeyEvent& event) OVERRIDE; |
261 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 280 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
262 virtual bool HasFocus() const OVERRIDE; | 281 virtual bool HasFocus() const OVERRIDE; |
263 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 282 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
264 | 283 |
265 // views::DragController: | 284 // views::DragController: |
266 virtual void WriteDragDataForView(View* sender, | 285 virtual void WriteDragDataForView(View* sender, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 // in the right location. | 516 // in the right location. |
498 int animation_offset_; | 517 int animation_offset_; |
499 | 518 |
500 // Used to register for notifications received by NotificationObserver. | 519 // Used to register for notifications received by NotificationObserver. |
501 content::NotificationRegistrar registrar_; | 520 content::NotificationRegistrar registrar_; |
502 | 521 |
503 DISALLOW_COPY_AND_ASSIGN(LocationBarView); | 522 DISALLOW_COPY_AND_ASSIGN(LocationBarView); |
504 }; | 523 }; |
505 | 524 |
506 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 525 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |