Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 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 BrowserShowContentRelated; | |
|
sky
2012/03/05 16:30:56
Can you remove some of these now?
altimofeev
2012/03/07 21:01:39
Done.
| |
| 37 class BrowserShowPageInfo; | |
| 38 class ContentSettingBubbleModelDelegate; | |
| 36 class ContentSettingImageView; | 39 class ContentSettingImageView; |
| 40 class CommandUpdater; | |
| 37 class EVBubbleView; | 41 class EVBubbleView; |
| 38 class ExtensionAction; | 42 class ExtensionAction; |
| 39 class GURL; | 43 class GURL; |
| 40 class InstantController; | 44 class InstantController; |
| 41 class KeywordHintView; | 45 class KeywordHintView; |
| 42 class LocationIconView; | 46 class LocationIconView; |
| 43 class PageActionWithBadgeView; | 47 class PageActionWithBadgeView; |
| 48 class PageActionImageView; | |
| 49 class Profile; | |
| 44 class SelectedKeywordView; | 50 class SelectedKeywordView; |
| 45 class StarView; | 51 class StarView; |
| 46 class TabContentsWrapper; | 52 class TabContentsWrapper; |
| 47 class TemplateURLService; | 53 class TemplateURLService; |
| 48 | 54 |
| 55 namespace views { | |
| 56 class BubbleDelegateView; | |
| 57 class Widget; | |
| 58 } | |
| 59 | |
| 49 #if defined(OS_WIN) || defined(USE_AURA) | 60 #if defined(OS_WIN) || defined(USE_AURA) |
| 50 class SuggestedTextView; | 61 class SuggestedTextView; |
| 51 #endif | 62 #endif |
| 52 | 63 |
| 53 ///////////////////////////////////////////////////////////////////////////// | 64 ///////////////////////////////////////////////////////////////////////////// |
| 54 // | 65 // |
| 55 // LocationBarView class | 66 // LocationBarView class |
| 56 // | 67 // |
| 57 // The LocationBarView class is a View subclass that paints the background | 68 // The LocationBarView class is a View subclass that paints the background |
| 58 // of the URL bar strip and contains its content. | 69 // of the URL bar strip and contains its content. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 78 int animation_offset() const { return animation_offset_; } | 89 int animation_offset() const { return animation_offset_; } |
| 79 | 90 |
| 80 class Delegate { | 91 class Delegate { |
| 81 public: | 92 public: |
| 82 // Should return the current tab contents. | 93 // Should return the current tab contents. |
| 83 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; | 94 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; |
| 84 | 95 |
| 85 // Returns the InstantController, or NULL if there isn't one. | 96 // Returns the InstantController, or NULL if there isn't one. |
| 86 virtual InstantController* GetInstant() = 0; | 97 virtual InstantController* GetInstant() = 0; |
| 87 | 98 |
| 99 // Creates Widget for the given delegate. | |
| 100 virtual views::Widget* CreateViewsBubble( | |
| 101 views::BubbleDelegateView* bubble_delegate) = 0; | |
| 102 | |
| 103 // Creates PageActionImageView. Caller gets an ownership. | |
| 104 virtual PageActionImageView* CreatePageActionImageView( | |
| 105 LocationBarView* owner, | |
| 106 ExtensionAction* action) = 0; | |
| 107 | |
| 108 // Returns ContentSettingBubbleModelDelegate. | |
| 109 virtual ContentSettingBubbleModelDelegate* | |
| 110 GetContentSettingBubbleModelDelegate() = 0; | |
| 111 | |
| 112 // Shows page information in the given web contents. | |
| 113 virtual void ShowPageInfo(content::WebContents* web_contents, | |
| 114 const GURL& url, | |
| 115 const content::SSLStatus& ssl, | |
| 116 bool show_history) = 0; | |
| 117 | |
| 88 // Called by the location bar view when the user starts typing in the edit. | 118 // Called by the location bar view when the user starts typing in the edit. |
| 89 // This forces our security style to be UNKNOWN for the duration of the | 119 // This forces our security style to be UNKNOWN for the duration of the |
| 90 // editing. | 120 // editing. |
| 91 virtual void OnInputInProgress(bool in_progress) = 0; | 121 virtual void OnInputInProgress(bool in_progress) = 0; |
| 92 }; | 122 }; |
| 93 | 123 |
| 94 enum ColorKind { | 124 enum ColorKind { |
| 95 BACKGROUND = 0, | 125 BACKGROUND = 0, |
| 96 TEXT, | 126 TEXT, |
| 97 SELECTED_TEXT, | 127 SELECTED_TEXT, |
| 98 DEEMPHASIZED_TEXT, | 128 DEEMPHASIZED_TEXT, |
| 99 SECURITY_TEXT, | 129 SECURITY_TEXT, |
| 100 }; | 130 }; |
| 101 | 131 |
| 102 // The modes reflect the different scenarios where a location bar can be used. | 132 // The modes reflect the different scenarios where a location bar can be used. |
| 103 // The normal mode is the mode used in a regular browser window. | 133 // The normal mode is the mode used in a regular browser window. |
| 104 // In popup mode, the location bar view is read only and has a slightly | 134 // In popup mode, the location bar view is read only and has a slightly |
| 105 // different presentation (font size / color). | 135 // different presentation (font size / color). |
| 106 // In app launcher mode, the location bar is empty and no security states or | 136 // In app launcher mode, the location bar is empty and no security states or |
| 107 // page/browser actions are displayed. | 137 // page/browser actions are displayed. |
| 108 enum Mode { | 138 enum Mode { |
| 109 NORMAL = 0, | 139 NORMAL = 0, |
| 110 POPUP, | 140 POPUP, |
| 111 APP_LAUNCHER | 141 APP_LAUNCHER |
| 112 }; | 142 }; |
| 113 | 143 |
| 114 LocationBarView(Browser* browser, | 144 LocationBarView(Profile* profile, |
| 145 CommandUpdater* command_updater, | |
| 115 ToolbarModel* model, | 146 ToolbarModel* model, |
| 116 Delegate* delegate, | 147 Delegate* delegate, |
| 117 Mode mode); | 148 Mode mode); |
| 149 | |
| 118 virtual ~LocationBarView(); | 150 virtual ~LocationBarView(); |
| 119 | 151 |
| 120 void Init(); | 152 void Init(); |
| 121 | 153 |
| 122 // True if this instance has been initialized by calling Init, which can only | 154 // 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. | 155 // be called when the receiving instance is attached to a view container. |
| 124 bool IsInitialized() const; | 156 bool IsInitialized() const; |
| 125 | 157 |
| 126 // Returns the appropriate color for the desired kind, based on the user's | 158 // Returns the appropriate color for the desired kind, based on the user's |
| 127 // system theme. | 159 // system theme. |
| 128 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, | 160 static SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
| 129 ColorKind kind); | 161 ColorKind kind); |
| 130 | 162 |
| 131 // Updates the location bar. We also reset the bar's permanent text and | 163 // 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 | 164 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
| 133 // saved state that the tab holds. | 165 // saved state that the tab holds. |
| 134 void Update(const content::WebContents* tab_for_state_restoring); | 166 void Update(const content::WebContents* tab_for_state_restoring); |
| 135 | 167 |
| 136 Browser* browser() const { return browser_; } | 168 // Returns corresponding profile. |
| 169 Profile* profile() const { return profile_; } | |
| 170 | |
| 171 // Returns the delegate. | |
| 172 Delegate* delegate() const { return delegate_; } | |
| 137 | 173 |
| 138 // Sets |preview_enabled| for the PageAction View associated with this | 174 // Sets |preview_enabled| for the PageAction View associated with this |
| 139 // |page_action|. If |preview_enabled| is true, the view will display the | 175 // |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. | 176 // PageActions icon even though it has not been activated by the extension. |
| 141 // This is used by the ExtensionInstalledBubble to preview what the icon | 177 // This is used by the ExtensionInstalledBubble to preview what the icon |
| 142 // will look like for the user upon installation of the extension. | 178 // will look like for the user upon installation of the extension. |
| 143 void SetPreviewEnabledPageAction(ExtensionAction *page_action, | 179 void SetPreviewEnabledPageAction(ExtensionAction *page_action, |
| 144 bool preview_enabled); | 180 bool preview_enabled); |
| 145 | 181 |
| 146 // Retrieves the PageAction View which is associated with |page_action|. | 182 // 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(); | 377 OmniboxViewWin* GetOmniboxViewWin(); |
| 342 #endif | 378 #endif |
| 343 #endif | 379 #endif |
| 344 | 380 |
| 345 // Helper to show the first run info bubble. | 381 // Helper to show the first run info bubble. |
| 346 void ShowFirstRunBubbleInternal(); | 382 void ShowFirstRunBubbleInternal(); |
| 347 | 383 |
| 348 // The Autocomplete Edit field. | 384 // The Autocomplete Edit field. |
| 349 scoped_ptr<OmniboxView> location_entry_; | 385 scoped_ptr<OmniboxView> location_entry_; |
| 350 | 386 |
| 351 // The Browser object that corresponds to this View. | 387 Profile* profile_; |
| 352 Browser* browser_; | 388 CommandUpdater* command_updater_; |
| 353 | 389 |
| 354 // The model. | 390 // The model. |
| 355 ToolbarModel* model_; | 391 ToolbarModel* model_; |
| 356 | 392 |
| 357 // Our delegate. | 393 // Our delegate. |
| 358 Delegate* delegate_; | 394 Delegate* delegate_; |
| 359 | 395 |
| 360 // This is the string of text from the autocompletion session that the user | 396 // This is the string of text from the autocompletion session that the user |
| 361 // entered or selected. | 397 // entered or selected. |
| 362 string16 location_input_; | 398 string16 location_input_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 // While animating, the host clips the widget and draws only the bottom | 462 // 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 | 463 // 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 | 464 // the widget so that we can draw the curved edges that attach to the toolbar |
| 429 // in the right location. | 465 // in the right location. |
| 430 int animation_offset_; | 466 int animation_offset_; |
| 431 | 467 |
| 432 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 468 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
| 433 }; | 469 }; |
| 434 | 470 |
| 435 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 471 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |