Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: ios/chrome/browser/ui/omnibox/location_bar_view_ios.h

Issue 2589803002: Upstream Chrome on iOS source code [6/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_LOCATION_BAR_VIEW_IOS_H_
6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_LOCATION_BAR_VIEW_IOS_H_
7
8 #include <UIKit/UIKit.h>
9
10 #include <memory>
11
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/strings/utf_string_conversions.h"
14 #include "components/omnibox/browser/omnibox_view.h"
15 #include "ios/chrome/browser/ui/omnibox/web_omnibox_edit_controller.h"
16 #include "ui/base/page_transition_types.h"
17 #include "url/gurl.h"
18
19 namespace ios {
20 class ChromeBrowserState;
21 }
22
23 namespace web {
24 class WebState;
25 }
26
27 class OmniboxViewIOS;
28 @class OmniboxClearButtonBridge;
29 @protocol OmniboxPopupPositioner;
30 @class OmniboxTextFieldIOS;
31 @protocol PreloadProvider;
32 class ToolbarModel;
33
34 // Delegate for LocationBarViewIOS objects. Used to provide the location bar a
35 // way to open URLs and otherwise interact with the browser.
36 @protocol LocationBarDelegate
37 - (void)loadGURLFromLocationBar:(const GURL&)url
38 transition:(ui::PageTransition)transition;
39 - (void)locationBarHasBecomeFirstResponder;
40 - (void)locationBarHasResignedFirstResponder;
41 - (void)locationBarBeganEdit;
42 - (void)locationBarChanged;
43 - (web::WebState*)getWebState;
44 - (ToolbarModel*)toolbarModel;
45 @end
46
47 // C++ object that wraps an OmniboxViewIOS and serves as its
48 // OmniboxEditController. LocationBarViewIOS bridges between the edit view
49 // and the rest of the browser and manages text field decorations (location
50 // icon, security icon, etc.).
51 class LocationBarViewIOS : public WebOmniboxEditController {
52 public:
53 LocationBarViewIOS(OmniboxTextFieldIOS* field,
54 ios::ChromeBrowserState* browser_state,
55 id<PreloadProvider> preloader,
56 id<OmniboxPopupPositioner> positioner,
57 id<LocationBarDelegate> delegate);
58 ~LocationBarViewIOS() override;
59
60 // OmniboxEditController implementation
61 void OnAutocompleteAccept(const GURL& url,
62 WindowOpenDisposition disposition,
63 ui::PageTransition transition,
64 AutocompleteMatchType::Type type) override;
65 void OnChanged() override;
66 void OnInputInProgress(bool in_progress) override;
67 void OnSetFocus() override;
68 ToolbarModel* GetToolbarModel() override;
69 const ToolbarModel* GetToolbarModel() const override;
70
71 // WebOmniboxEditController implementation.
72 web::WebState* GetWebState() override;
73 void OnKillFocus() override;
74
75 // Called when toolbar state is updated.
76 void OnToolbarUpdated();
77
78 // Resign omnibox first responder and end edit view editing.
79 void HideKeyboardAndEndEditing();
80
81 // Tells the omnibox if it can show the hint text or not.
82 void SetShouldShowHintText(bool show_hint_text);
83
84 // Returns a pointer to the text entry view.
85 const OmniboxView* GetLocationEntry() const;
86 OmniboxView* GetLocationEntry();
87
88 // True if the omnibox text field is showing a placeholder image in its left
89 // view while it's collapsed (i.e. not in editing mode).
90 bool IsShowingPlaceholderWhileCollapsed();
91
92 private:
93 // Installs a UIButton that serves as the location icon and lock icon. This
94 // button is installed as a left view of |field_|.
95 void InstallLocationIcon();
96
97 // Creates and installs the voice search UIButton as a right view of |field_|.
98 // Does nothing on tablet.
99 void InstallVoiceSearchIcon();
100
101 // Creates the clear text UIButton to be used as a right view of |field_|.
102 void CreateClearTextIcon(bool is_incognito);
103
104 // Updates the view to show the appropriate button (e.g. clear text or voice
105 // search) on the right side of |field_|.
106 void UpdateRightDecorations();
107
108 bool show_hint_text_;
109 base::scoped_nsobject<UIButton> clear_text_button_;
110 std::unique_ptr<OmniboxViewIOS> edit_view_;
111 base::scoped_nsobject<OmniboxClearButtonBridge> clear_button_bridge_;
112 OmniboxTextFieldIOS* field_;
113 id<LocationBarDelegate> delegate_;
114 bool is_showing_placeholder_while_collapsed_;
115 };
116
117 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_LOCATION_BAR_VIEW_IOS_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox/chrome_omnibox_client_ios.mm ('k') | ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698