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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #if defined(USE_AURA) | 27 #if defined(USE_AURA) |
28 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 28 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
29 #elif defined(OS_WIN) | 29 #elif defined(OS_WIN) |
30 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 30 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
31 #elif defined(TOOLKIT_USES_GTK) | 31 #elif defined(TOOLKIT_USES_GTK) |
32 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | 32 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
33 #endif | 33 #endif |
34 | 34 |
35 class Browser; | 35 class Browser; |
36 class ContentSettingImageView; | 36 class ContentSettingImageView; |
37 class CommandUpdater; | |
37 class EVBubbleView; | 38 class EVBubbleView; |
38 class ExtensionAction; | 39 class ExtensionAction; |
39 class GURL; | 40 class GURL; |
40 class InstantController; | 41 class InstantController; |
41 class KeywordHintView; | 42 class KeywordHintView; |
42 class LocationIconView; | 43 class LocationIconView; |
43 class PageActionWithBadgeView; | 44 class PageActionWithBadgeView; |
45 class Profile; | |
44 class SelectedKeywordView; | 46 class SelectedKeywordView; |
45 class StarView; | 47 class StarView; |
46 class TabContentsWrapper; | 48 class TabContentsWrapper; |
47 class TemplateURLService; | 49 class TemplateURLService; |
48 | 50 |
49 #if defined(OS_WIN) || defined(USE_AURA) | 51 #if defined(OS_WIN) || defined(USE_AURA) |
50 class SuggestedTextView; | 52 class SuggestedTextView; |
51 #endif | 53 #endif |
52 | 54 |
53 ///////////////////////////////////////////////////////////////////////////// | 55 ///////////////////////////////////////////////////////////////////////////// |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 // In popup mode, the location bar view is read only and has a slightly | 106 // In popup mode, the location bar view is read only and has a slightly |
105 // different presentation (font size / color). | 107 // different presentation (font size / color). |
106 // In app launcher mode, the location bar is empty and no security states or | 108 // In app launcher mode, the location bar is empty and no security states or |
107 // page/browser actions are displayed. | 109 // page/browser actions are displayed. |
108 enum Mode { | 110 enum Mode { |
109 NORMAL = 0, | 111 NORMAL = 0, |
110 POPUP, | 112 POPUP, |
111 APP_LAUNCHER | 113 APP_LAUNCHER |
112 }; | 114 }; |
113 | 115 |
114 LocationBarView(Browser* browser, | 116 LocationBarView(Profile* profile, |
117 CommandUpdater* command_updater, | |
115 ToolbarModel* model, | 118 ToolbarModel* model, |
116 Delegate* delegate, | 119 Delegate* delegate, |
117 Mode mode); | 120 Mode mode); |
121 | |
118 virtual ~LocationBarView(); | 122 virtual ~LocationBarView(); |
119 | 123 |
120 void Init(); | 124 void Init(); |
121 | 125 |
122 // True if this instance has been initialized by calling Init, which can only | 126 // True if this instance has been initialized by calling Init, which can only |
123 // be called when the receiving instance is attached to a view container. | 127 // be called when the receiving instance is attached to a view container. |
124 bool IsInitialized() const; | 128 bool IsInitialized() const; |
125 | 129 |
126 // Returns the appropriate color for the desired kind, based on the user's | 130 // Returns the appropriate color for the desired kind, based on the user's |
127 // system theme. | 131 // system theme. |
128 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, | 132 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
129 ColorKind kind); | 133 ColorKind kind); |
130 | 134 |
131 // Updates the location bar. We also reset the bar's permanent text and | 135 // Updates the location bar. We also reset the bar's permanent text and |
132 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore | 136 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
133 // saved state that the tab holds. | 137 // saved state that the tab holds. |
134 void Update(const content::WebContents* tab_for_state_restoring); | 138 void Update(const content::WebContents* tab_for_state_restoring); |
135 | 139 |
136 Browser* browser() const { return browser_; } | 140 // Returns corresponding browser. Could return NULL if there is no browser or |
141 // WebContents hasn't been created yet. | |
142 // Note, to get profile use 'profile()' method below. | |
143 Browser* FindBrowser(); | |
sky
2012/02/28 18:24:24
Same comment here as with ToolbarModel.
altimofeev
2012/02/29 18:57:29
Done. I've created interfaces BrowserShowContentRe
| |
144 | |
145 // Returns corresponding profile. | |
146 Profile* profile() const { return profile_; } | |
137 | 147 |
138 // Sets |preview_enabled| for the PageAction View associated with this | 148 // Sets |preview_enabled| for the PageAction View associated with this |
139 // |page_action|. If |preview_enabled| is true, the view will display the | 149 // |page_action|. If |preview_enabled| is true, the view will display the |
140 // PageActions icon even though it has not been activated by the extension. | 150 // PageActions icon even though it has not been activated by the extension. |
141 // This is used by the ExtensionInstalledBubble to preview what the icon | 151 // This is used by the ExtensionInstalledBubble to preview what the icon |
142 // will look like for the user upon installation of the extension. | 152 // will look like for the user upon installation of the extension. |
143 void SetPreviewEnabledPageAction(ExtensionAction *page_action, | 153 void SetPreviewEnabledPageAction(ExtensionAction *page_action, |
144 bool preview_enabled); | 154 bool preview_enabled); |
145 | 155 |
146 // Retrieves the PageAction View which is associated with |page_action|. | 156 // Retrieves the PageAction View which is associated with |page_action|. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 OmniboxViewWin* GetOmniboxViewWin(); | 351 OmniboxViewWin* GetOmniboxViewWin(); |
342 #endif | 352 #endif |
343 #endif | 353 #endif |
344 | 354 |
345 // Helper to show the first run info bubble. | 355 // Helper to show the first run info bubble. |
346 void ShowFirstRunBubbleInternal(); | 356 void ShowFirstRunBubbleInternal(); |
347 | 357 |
348 // The Autocomplete Edit field. | 358 // The Autocomplete Edit field. |
349 scoped_ptr<OmniboxView> location_entry_; | 359 scoped_ptr<OmniboxView> location_entry_; |
350 | 360 |
351 // The Browser object that corresponds to this View. | 361 Profile* profile_; |
362 CommandUpdater* command_updater_; | |
363 | |
364 // Cached value of the browser. Useful because searching needs O(N) time, | |
365 // where N is the number of tabs. | |
352 Browser* browser_; | 366 Browser* browser_; |
353 | 367 |
354 // The model. | 368 // The model. |
355 ToolbarModel* model_; | 369 ToolbarModel* model_; |
356 | 370 |
357 // Our delegate. | 371 // Our delegate. |
358 Delegate* delegate_; | 372 Delegate* delegate_; |
359 | 373 |
360 // This is the string of text from the autocompletion session that the user | 374 // This is the string of text from the autocompletion session that the user |
361 // entered or selected. | 375 // entered or selected. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 // While animating, the host clips the widget and draws only the bottom | 440 // 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 | 441 // 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 | 442 // the widget so that we can draw the curved edges that attach to the toolbar |
429 // in the right location. | 443 // in the right location. |
430 int animation_offset_; | 444 int animation_offset_; |
431 | 445 |
432 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 446 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
433 }; | 447 }; |
434 | 448 |
435 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 449 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |