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