OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_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/task.h" | 11 #include "base/task.h" |
12 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 12 #include "chrome/browser/autocomplete/autocomplete_edit.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/first_run.h" | 14 #include "chrome/browser/first_run.h" |
15 #include "chrome/browser/location_bar.h" | 15 #include "chrome/browser/location_bar.h" |
16 #include "chrome/browser/search_engines/template_url_model.h" | |
17 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
18 #include "chrome/browser/toolbar_model.h" | 17 #include "chrome/browser/toolbar_model.h" |
19 #include "chrome/browser/views/extensions/extension_popup.h" | 18 #include "chrome/browser/views/extensions/extension_popup.h" |
20 #include "chrome/common/notification_observer.h" | 19 #include "chrome/common/notification_observer.h" |
21 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
22 #include "gfx/font.h" | 21 #include "gfx/font.h" |
23 #include "gfx/rect.h" | 22 #include "gfx/rect.h" |
24 #include "views/controls/native/native_view_host.h" | 23 #include "views/controls/native/native_view_host.h" |
25 | 24 |
26 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
(...skipping 25 matching lines...) Expand all Loading... |
52 // LocationBarView class | 51 // LocationBarView class |
53 // | 52 // |
54 // The LocationBarView class is a View subclass that paints the background | 53 // The LocationBarView class is a View subclass that paints the background |
55 // of the URL bar strip and contains its content. | 54 // of the URL bar strip and contains its content. |
56 // | 55 // |
57 ///////////////////////////////////////////////////////////////////////////// | 56 ///////////////////////////////////////////////////////////////////////////// |
58 class LocationBarView : public LocationBar, | 57 class LocationBarView : public LocationBar, |
59 public LocationBarTesting, | 58 public LocationBarTesting, |
60 public views::View, | 59 public views::View, |
61 public views::DragController, | 60 public views::DragController, |
62 public AutocompleteEditController, | 61 public AutocompleteEditController { |
63 public TemplateURLModelObserver { | |
64 public: | 62 public: |
65 // The location bar view's class name. | 63 // The location bar view's class name. |
66 static const char kViewClassName[]; | 64 static const char kViewClassName[]; |
67 | 65 |
68 class Delegate { | 66 class Delegate { |
69 public: | 67 public: |
70 // Should return the current tab contents. | 68 // Should return the current tab contents. |
71 virtual TabContents* GetTabContents() = 0; | 69 virtual TabContents* GetTabContents() = 0; |
72 | 70 |
73 // Called by the location bar view when the user starts typing in the edit. | 71 // Called by the location bar view when the user starts typing in the edit. |
(...skipping 24 matching lines...) Expand all Loading... |
98 | 96 |
99 LocationBarView(Profile* profile, | 97 LocationBarView(Profile* profile, |
100 CommandUpdater* command_updater, | 98 CommandUpdater* command_updater, |
101 ToolbarModel* model, | 99 ToolbarModel* model, |
102 Delegate* delegate, | 100 Delegate* delegate, |
103 Mode mode); | 101 Mode mode); |
104 virtual ~LocationBarView(); | 102 virtual ~LocationBarView(); |
105 | 103 |
106 void Init(); | 104 void Init(); |
107 | 105 |
108 // True if this instance has been initialized by calling Init, which can only | 106 // Returns whether this instance has been initialized by callin Init. Init can |
109 // be called when the receiving instance is attached to a view container. | 107 // only be called when the receiving instance is attached to a view container. |
110 bool IsInitialized() const; | 108 bool IsInitialized() const; |
111 | 109 |
112 // Returns the appropriate color for the desired kind, based on the user's | 110 // Returns the appropriate color for the desired kind, based on the user's |
113 // system theme. | 111 // system theme. |
114 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, | 112 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
115 ColorKind kind); | 113 ColorKind kind); |
116 | 114 |
117 // Updates the location bar. We also reset the bar's permanent text and | 115 // Updates the location bar. We also reset the bar's permanent text and |
118 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore | 116 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
119 // saved state that the tab holds. | 117 // saved state that the tab holds. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 213 } |
216 virtual LocationBarTesting* GetLocationBarForTesting() { return this; } | 214 virtual LocationBarTesting* GetLocationBarForTesting() { return this; } |
217 | 215 |
218 // Overridden from LocationBarTesting: | 216 // Overridden from LocationBarTesting: |
219 virtual int PageActionCount() { return page_action_views_.size(); } | 217 virtual int PageActionCount() { return page_action_views_.size(); } |
220 virtual int PageActionVisibleCount(); | 218 virtual int PageActionVisibleCount(); |
221 virtual ExtensionAction* GetPageAction(size_t index); | 219 virtual ExtensionAction* GetPageAction(size_t index); |
222 virtual ExtensionAction* GetVisiblePageAction(size_t index); | 220 virtual ExtensionAction* GetVisiblePageAction(size_t index); |
223 virtual void TestPageActionPressed(size_t index); | 221 virtual void TestPageActionPressed(size_t index); |
224 | 222 |
225 // Overridden from TemplateURLModelObserver | |
226 virtual void OnTemplateURLModelChanged(); | |
227 | |
228 static const int kVertMargin; // Space above and below the edit. | 223 static const int kVertMargin; // Space above and below the edit. |
229 static const int kEdgeThickness; // Unavailable space at horizontal edges. | 224 static const int kEdgeThickness; // Unavailable space at horizontal edges. |
230 static const int kItemPadding; // Space between items within the bar. | 225 static const int kItemPadding; // Space between items within the bar. |
231 | 226 |
232 protected: | 227 protected: |
233 void Focus(); | 228 void Focus(); |
234 | 229 |
235 private: | 230 private: |
236 typedef std::vector<ContentSettingImageView*> ContentSettingViews; | 231 typedef std::vector<ContentSettingImageView*> ContentSettingViews; |
237 | 232 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // The star. | 344 // The star. |
350 StarView* star_view_; | 345 StarView* star_view_; |
351 | 346 |
352 // The mode that dictates how the bar shows. | 347 // The mode that dictates how the bar shows. |
353 Mode mode_; | 348 Mode mode_; |
354 | 349 |
355 // True if we should show a focus rect while the location entry field is | 350 // True if we should show a focus rect while the location entry field is |
356 // focused. Used when the toolbar is in full keyboard accessibility mode. | 351 // focused. Used when the toolbar is in full keyboard accessibility mode. |
357 bool show_focus_rect_; | 352 bool show_focus_rect_; |
358 | 353 |
359 // Whether bubble text is short or long. | |
360 FirstRun::BubbleType bubble_type_; | |
361 | |
362 #if defined(OS_LINUX) | 354 #if defined(OS_LINUX) |
363 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; | 355 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; |
364 #endif | 356 #endif |
365 | 357 |
| 358 // Used to schedule a task for the first run info bubble. |
| 359 ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_; |
| 360 |
366 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 361 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
367 }; | 362 }; |
368 | 363 |
369 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 364 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |