blob: 807d99e791a3ca808ef263a2c4526197d344fd28 [file] [log] [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_WEB_LOCATION_BAR_IMPL_H_
#define IOS_CHROME_BROWSER_UI_OMNIBOX_WEB_LOCATION_BAR_IMPL_H_
#include "ios/chrome/browser/ui/omnibox/web_location_bar.h"
@protocol LocationBarURLLoader;
@protocol OmniboxControllerDelegate;
@protocol OmniboxFocusDelegate;
// A minimal implementation of WebLocationBar. Designed to work
// with LocationBarMediator and LocationBarCoordinator.
// TODO(crbug.com/818641): downgrade from WebLocationBar subclass straight to
// WebLocationBar once OmniboxViewIOS doesn't need it.
class WebLocationBarImpl : public WebLocationBar {
public:
WebLocationBarImpl(id<OmniboxControllerDelegate> delegate,
id<OmniboxFocusDelegate> focus_delegate);
~WebLocationBarImpl() override;
void SetURLLoader(id<LocationBarURLLoader> URLLoader) {
URLLoader_ = URLLoader;
}
// WebLocationBar methods.
web::WebState* GetWebState() override;
void OnKillFocus() override;
void OnSetFocus() override;
void OnNavigate(const GURL& destination_url,
TemplateURLRef::PostContent* post_content,
WindowOpenDisposition disposition,
ui::PageTransition transition,
bool destination_url_entered_without_scheme,
const AutocompleteMatch& match) override;
LocationBarModel* GetLocationBarModel() override;
private:
__weak id<OmniboxControllerDelegate> delegate_;
__weak id<OmniboxFocusDelegate> focus_delegate_;
__weak id<LocationBarURLLoader> URLLoader_;
};
#endif // IOS_CHROME_BROWSER_UI_OMNIBOX_WEB_LOCATION_BAR_IMPL_H_