OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 class Browser; | 35 class Browser; |
36 class ContentSettingImageView; | 36 class ContentSettingImageView; |
37 class EVBubbleView; | 37 class EVBubbleView; |
38 class ExtensionAction; | 38 class ExtensionAction; |
39 class GURL; | 39 class GURL; |
40 class InstantController; | 40 class InstantController; |
41 class KeywordHintView; | 41 class KeywordHintView; |
42 class LocationIconView; | 42 class LocationIconView; |
43 class PageActionWithBadgeView; | 43 class PageActionWithBadgeView; |
44 class Profile; | |
45 class SelectedKeywordView; | 44 class SelectedKeywordView; |
46 class StarView; | 45 class StarView; |
47 class TabContents; | 46 class TabContents; |
48 class TabContentsWrapper; | 47 class TabContentsWrapper; |
49 class TemplateURLService; | 48 class TemplateURLService; |
50 | 49 |
51 namespace views { | 50 namespace views { |
52 class HorizontalPainter; | 51 class HorizontalPainter; |
53 class Label; | 52 class Label; |
54 } // namespace views | 53 } // namespace views |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // In popup mode, the location bar view is read only and has a slightly | 110 // In popup mode, the location bar view is read only and has a slightly |
112 // different presentation (font size / color). | 111 // different presentation (font size / color). |
113 // In app launcher mode, the location bar is empty and no security states or | 112 // In app launcher mode, the location bar is empty and no security states or |
114 // page/browser actions are displayed. | 113 // page/browser actions are displayed. |
115 enum Mode { | 114 enum Mode { |
116 NORMAL = 0, | 115 NORMAL = 0, |
117 POPUP, | 116 POPUP, |
118 APP_LAUNCHER | 117 APP_LAUNCHER |
119 }; | 118 }; |
120 | 119 |
121 LocationBarView(Profile* profile, | 120 LocationBarView(Browser* browser, |
122 Browser* browser, | |
123 ToolbarModel* model, | 121 ToolbarModel* model, |
124 Delegate* delegate, | 122 Delegate* delegate, |
125 Mode mode); | 123 Mode mode); |
126 virtual ~LocationBarView(); | 124 virtual ~LocationBarView(); |
127 | 125 |
128 void Init(); | 126 void Init(); |
129 | 127 |
130 // True if this instance has been initialized by calling Init, which can only | 128 // True if this instance has been initialized by calling Init, which can only |
131 // be called when the receiving instance is attached to a view container. | 129 // be called when the receiving instance is attached to a view container. |
132 bool IsInitialized() const; | 130 bool IsInitialized() const; |
133 | 131 |
134 // Returns the appropriate color for the desired kind, based on the user's | 132 // Returns the appropriate color for the desired kind, based on the user's |
135 // system theme. | 133 // system theme. |
136 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, | 134 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
137 ColorKind kind); | 135 ColorKind kind); |
138 | 136 |
139 // Updates the location bar. We also reset the bar's permanent text and | 137 // Updates the location bar. We also reset the bar's permanent text and |
140 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore | 138 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
141 // saved state that the tab holds. | 139 // saved state that the tab holds. |
142 void Update(const TabContents* tab_for_state_restoring); | 140 void Update(const TabContents* tab_for_state_restoring); |
143 | 141 |
144 void SetProfile(Profile* profile); | |
145 Profile* profile() const { return profile_; } | |
146 Browser* browser() const { return browser_; } | 142 Browser* browser() const { return browser_; } |
147 | 143 |
148 // Sets |preview_enabled| for the PageAction View associated with this | 144 // Sets |preview_enabled| for the PageAction View associated with this |
149 // |page_action|. If |preview_enabled| is true, the view will display the | 145 // |page_action|. If |preview_enabled| is true, the view will display the |
150 // PageActions icon even though it has not been activated by the extension. | 146 // PageActions icon even though it has not been activated by the extension. |
151 // This is used by the ExtensionInstalledBubble to preview what the icon | 147 // This is used by the ExtensionInstalledBubble to preview what the icon |
152 // will look like for the user upon installation of the extension. | 148 // will look like for the user upon installation of the extension. |
153 void SetPreviewEnabledPageAction(ExtensionAction *page_action, | 149 void SetPreviewEnabledPageAction(ExtensionAction *page_action, |
154 bool preview_enabled); | 150 bool preview_enabled); |
155 | 151 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 bool HasValidSuggestText() const; | 328 bool HasValidSuggestText() const; |
333 | 329 |
334 // Returns |location_entry_| cast to OmniboxViewWin, or NULL if | 330 // Returns |location_entry_| cast to OmniboxViewWin, or NULL if |
335 // |location_entry_| is of a different type. | 331 // |location_entry_| is of a different type. |
336 OmniboxViewWin* GetOmniboxViewWin(); | 332 OmniboxViewWin* GetOmniboxViewWin(); |
337 #endif | 333 #endif |
338 | 334 |
339 // Helper to show the first run info bubble. | 335 // Helper to show the first run info bubble. |
340 void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type); | 336 void ShowFirstRunBubbleInternal(FirstRun::BubbleType bubble_type); |
341 | 337 |
342 // Current profile. Not owned by us. | |
343 Profile* profile_; | |
344 | |
345 // The Autocomplete Edit field. | 338 // The Autocomplete Edit field. |
346 scoped_ptr<OmniboxView> location_entry_; | 339 scoped_ptr<OmniboxView> location_entry_; |
347 | 340 |
348 // The Browser object that corresponds to this View. | 341 // The Browser object that corresponds to this View. |
349 Browser* browser_; | 342 Browser* browser_; |
350 | 343 |
351 // The model. | 344 // The model. |
352 ToolbarModel* model_; | 345 ToolbarModel* model_; |
353 | 346 |
354 // Our delegate. | 347 // Our delegate. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // While animating, the host clips the widget and draws only the bottom | 419 // While animating, the host clips the widget and draws only the bottom |
427 // part of it. The view needs to know the pixel offset at which we are drawing | 420 // part of it. The view needs to know the pixel offset at which we are drawing |
428 // the widget so that we can draw the curved edges that attach to the toolbar | 421 // the widget so that we can draw the curved edges that attach to the toolbar |
429 // in the right location. | 422 // in the right location. |
430 int animation_offset_; | 423 int animation_offset_; |
431 | 424 |
432 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 425 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
433 }; | 426 }; |
434 | 427 |
435 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 428 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |