| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 public: | 49 public: |
| 50 // Should return the current tab contents. | 50 // Should return the current tab contents. |
| 51 virtual TabContents* GetTabContents() = 0; | 51 virtual TabContents* GetTabContents() = 0; |
| 52 | 52 |
| 53 // Called by the location bar view when the user starts typing in the edit. | 53 // Called by the location bar view when the user starts typing in the edit. |
| 54 // This forces our security style to be UNKNOWN for the duration of the | 54 // This forces our security style to be UNKNOWN for the duration of the |
| 55 // editing. | 55 // editing. |
| 56 virtual void OnInputInProgress(bool in_progress) = 0; | 56 virtual void OnInputInProgress(bool in_progress) = 0; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 enum ColorKind { |
| 60 BACKGROUND = 0, |
| 61 TEXT, |
| 62 SELECTED_TEXT, |
| 63 DEEMPHASIZED_TEXT, |
| 64 SECURITY_TEXT, |
| 65 SECURITY_INFO_BUBBLE_TEXT, |
| 66 SCHEME_STRIKEOUT, |
| 67 NUM_KINDS |
| 68 }; |
| 69 |
| 59 LocationBarView(Profile* profile, | 70 LocationBarView(Profile* profile, |
| 60 CommandUpdater* command_updater, | 71 CommandUpdater* command_updater, |
| 61 ToolbarModel* model, | 72 ToolbarModel* model, |
| 62 Delegate* delegate, | 73 Delegate* delegate, |
| 63 bool popup_window_mode, | 74 bool popup_window_mode, |
| 64 AutocompletePopupPositioner* popup_positioner); | 75 AutocompletePopupPositioner* popup_positioner); |
| 65 virtual ~LocationBarView(); | 76 virtual ~LocationBarView(); |
| 66 | 77 |
| 67 void Init(); | 78 void Init(); |
| 68 | 79 |
| 69 // Returns whether this instance has been initialized by callin Init. Init can | 80 // Returns whether this instance has been initialized by callin Init. Init can |
| 70 // only be called when the receiving instance is attached to a view container. | 81 // only be called when the receiving instance is attached to a view container. |
| 71 bool IsInitialized() const; | 82 bool IsInitialized() const; |
| 72 | 83 |
| 84 // Returns the appropriate color for the desired kind, based on the user's |
| 85 // system theme. |
| 86 static SkColor GetColor(bool is_secure, ColorKind kind); |
| 87 |
| 73 // Updates the location bar. We also reset the bar's permanent text and | 88 // Updates the location bar. We also reset the bar's permanent text and |
| 74 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore | 89 // security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
| 75 // saved state that the tab holds. | 90 // saved state that the tab holds. |
| 76 void Update(const TabContents* tab_for_state_restoring); | 91 void Update(const TabContents* tab_for_state_restoring); |
| 77 | 92 |
| 78 void SetProfile(Profile* profile); | 93 void SetProfile(Profile* profile); |
| 79 Profile* profile() { return profile_; } | 94 Profile* profile() { return profile_; } |
| 80 | 95 |
| 81 // Sizing functions | 96 // Sizing functions |
| 82 virtual gfx::Size GetPreferredSize(); | 97 virtual gfx::Size GetPreferredSize(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 virtual void Revert(); | 147 virtual void Revert(); |
| 133 virtual AutocompleteEditView* location_entry() { | 148 virtual AutocompleteEditView* location_entry() { |
| 134 return location_entry_.get(); | 149 return location_entry_.get(); |
| 135 } | 150 } |
| 136 virtual LocationBarTesting* GetLocationBarForTesting() { return this; } | 151 virtual LocationBarTesting* GetLocationBarForTesting() { return this; } |
| 137 | 152 |
| 138 // Overridden from LocationBarTesting: | 153 // Overridden from LocationBarTesting: |
| 139 virtual int PageActionVisibleCount(); | 154 virtual int PageActionVisibleCount(); |
| 140 | 155 |
| 141 static const int kVertMargin; | 156 static const int kVertMargin; |
| 142 static const SkColor kBackgroundColorByLevel[]; | |
| 143 | 157 |
| 144 protected: | 158 protected: |
| 145 void Focus(); | 159 void Focus(); |
| 146 | 160 |
| 147 private: | 161 private: |
| 148 // View used when the user has selected a keyword. | 162 // View used when the user has selected a keyword. |
| 149 // | 163 // |
| 150 // SelectedKeywordView maintains two labels. One label contains the | 164 // SelectedKeywordView maintains two labels. One label contains the |
| 151 // complete description of the keyword, the second contains a truncated | 165 // complete description of the keyword, the second contains a truncated |
| 152 // version of the description. The second is used if there is not enough room | 166 // version of the description. The second is used if there is not enough room |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 bool popup_window_mode_; | 520 bool popup_window_mode_; |
| 507 | 521 |
| 508 // Used schedule a task for the first run info bubble. | 522 // Used schedule a task for the first run info bubble. |
| 509 ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_; | 523 ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_; |
| 510 | 524 |
| 511 // The positioner that places the autocomplete popup. | 525 // The positioner that places the autocomplete popup. |
| 512 AutocompletePopupPositioner* popup_positioner_; | 526 AutocompletePopupPositioner* popup_positioner_; |
| 513 }; | 527 }; |
| 514 | 528 |
| 515 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 529 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |