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_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 18 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
19 #include "chrome/browser/ui/location_bar/location_bar.h" | 19 #include "chrome/browser/ui/location_bar/location_bar.h" |
20 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" | 20 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" |
21 #include "components/content_settings/core/common/content_settings_types.h" | 21 #include "components/content_settings/core/common/content_settings_types.h" |
22 #include "components/prefs/pref_member.h" | 22 #include "components/prefs/pref_member.h" |
23 #include "components/security_state/security_state_model.h" | 23 #include "components/security_state/security_state_model.h" |
24 #include "components/zoom/zoom_event_manager_observer.h" | 24 #include "components/zoom/zoom_event_manager_observer.h" |
| 25 #include "components/omnibox/common/omnibox_focus_state.h" |
25 | 26 |
26 @class AutocompleteTextField; | 27 @class AutocompleteTextField; |
27 class CommandUpdater; | 28 class CommandUpdater; |
28 class ContentSettingDecoration; | 29 class ContentSettingDecoration; |
29 class KeywordHintDecoration; | 30 class KeywordHintDecoration; |
30 class LocationBarDecoration; | 31 class LocationBarDecoration; |
31 class LocationIconDecoration; | 32 class LocationIconDecoration; |
32 class ManagePasswordsDecoration; | 33 class ManagePasswordsDecoration; |
33 class PageActionDecoration; | 34 class PageActionDecoration; |
34 class Profile; | 35 class Profile; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // an update point for interface objects that need to set their appearance | 176 // an update point for interface objects that need to set their appearance |
176 // based on the window's theme. | 177 // based on the window's theme. |
177 void OnThemeChanged(); | 178 void OnThemeChanged(); |
178 | 179 |
179 // ChromeOmniboxEditController: | 180 // ChromeOmniboxEditController: |
180 void UpdateWithoutTabRestore() override; | 181 void UpdateWithoutTabRestore() override; |
181 void OnChanged() override; | 182 void OnChanged() override; |
182 ToolbarModel* GetToolbarModel() override; | 183 ToolbarModel* GetToolbarModel() override; |
183 const ToolbarModel* GetToolbarModel() const override; | 184 const ToolbarModel* GetToolbarModel() const override; |
184 content::WebContents* GetWebContents() override; | 185 content::WebContents* GetWebContents() override; |
| 186 void OnFocusChanged(OmniboxFocusState state) override; |
185 | 187 |
186 bool ShouldShowEVBubble() const; | 188 bool ShouldShowEVBubble() const; |
187 | 189 |
188 // Returns true if the security state decoration should be displayed. The | 190 // Returns true if the security state decoration should be displayed. The |
189 // security state should only be shown for valid and invalid HTTPS states. | 191 // security state should only be shown for valid and invalid HTTPS states. |
190 bool ShouldShowSecurityState() const; | 192 bool ShouldShowSecurityState() const; |
191 | 193 |
192 NSImage* GetKeywordImage(const base::string16& keyword); | 194 NSImage* GetKeywordImage(const base::string16& keyword); |
193 | 195 |
194 // Returns the color for the vector icon in the location bar. | 196 // Returns the color for the vector icon in the location bar. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 262 |
261 // Returns pointers to all of the LocationBarDecorations owned by this | 263 // Returns pointers to all of the LocationBarDecorations owned by this |
262 // LocationBarViewMac. This helper function is used for positioning and | 264 // LocationBarViewMac. This helper function is used for positioning and |
263 // re-positioning accessibility views. | 265 // re-positioning accessibility views. |
264 std::vector<LocationBarDecoration*> GetDecorations(); | 266 std::vector<LocationBarDecoration*> GetDecorations(); |
265 | 267 |
266 // Updates |decoration|'s accessibility view's position to match the computed | 268 // Updates |decoration|'s accessibility view's position to match the computed |
267 // position the decoration will be drawn at. | 269 // position the decoration will be drawn at. |
268 void UpdateAccessibilityViewPosition(LocationBarDecoration* decoration); | 270 void UpdateAccessibilityViewPosition(LocationBarDecoration* decoration); |
269 | 271 |
| 272 // Returns true when omnibox has focus. |
| 273 bool HasFocus() const; |
| 274 |
270 std::unique_ptr<OmniboxViewMac> omnibox_view_; | 275 std::unique_ptr<OmniboxViewMac> omnibox_view_; |
271 | 276 |
272 AutocompleteTextField* field_; // owned by tab controller | 277 AutocompleteTextField* field_; // owned by tab controller |
273 | 278 |
274 // A decoration that shows an icon to the left of the address. | 279 // A decoration that shows an icon to the left of the address. |
275 std::unique_ptr<LocationIconDecoration> location_icon_decoration_; | 280 std::unique_ptr<LocationIconDecoration> location_icon_decoration_; |
276 | 281 |
277 // A decoration that shows the keyword-search bubble on the left. | 282 // A decoration that shows the keyword-search bubble on the left. |
278 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; | 283 std::unique_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; |
279 | 284 |
(...skipping 25 matching lines...) Expand all Loading... |
305 std::unique_ptr<KeywordHintDecoration> keyword_hint_decoration_; | 310 std::unique_ptr<KeywordHintDecoration> keyword_hint_decoration_; |
306 | 311 |
307 // The right-hand-side button to manage passwords associated with a page. | 312 // The right-hand-side button to manage passwords associated with a page. |
308 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_; | 313 std::unique_ptr<ManagePasswordsDecoration> manage_passwords_decoration_; |
309 | 314 |
310 Browser* browser_; | 315 Browser* browser_; |
311 | 316 |
312 // Used to change the visibility of the star decoration. | 317 // Used to change the visibility of the star decoration. |
313 BooleanPrefMember edit_bookmarks_enabled_; | 318 BooleanPrefMember edit_bookmarks_enabled_; |
314 | 319 |
| 320 // Used to confirm the visibility of the keyword hint decoration. |
| 321 OmniboxFocusState focus_state_; |
| 322 |
315 // Indicates whether or not the location bar is currently visible. | 323 // Indicates whether or not the location bar is currently visible. |
316 bool location_bar_visible_; | 324 bool location_bar_visible_; |
317 | 325 |
318 // True if the HTTPS (non EV cert) state should be displayed on the security | 326 // True if the HTTPS (non EV cert) state should be displayed on the security |
319 // state decoration. | 327 // state decoration. |
320 bool should_show_secure_verbose_; | 328 bool should_show_secure_verbose_; |
321 | 329 |
322 // True if the security state decoration should be animated for changes in | 330 // True if the security state decoration should be animated for changes in |
323 // the security level. | 331 // the security level. |
324 bool should_animate_security_verbose_; | 332 bool should_animate_security_verbose_; |
325 | 333 |
326 // True if there's enough room for the omnibox to show the security verbose. | 334 // True if there's enough room for the omnibox to show the security verbose. |
327 // If the verbose is displaying the EV cert, then this should always be true. | 335 // If the verbose is displaying the EV cert, then this should always be true. |
328 bool is_width_available_for_security_verbose_; | 336 bool is_width_available_for_security_verbose_; |
329 | 337 |
330 // The security level of the location bar icon. | 338 // The security level of the location bar icon. |
331 security_state::SecurityStateModel::SecurityLevel security_level_; | 339 security_state::SecurityStateModel::SecurityLevel security_level_; |
332 | 340 |
333 // Used to schedule a task for the first run info bubble. | 341 // Used to schedule a task for the first run info bubble. |
334 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; | 342 base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; |
335 | |
336 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 343 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
337 }; | 344 }; |
338 | 345 |
339 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ | 346 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |