Commit 42771db3 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Add AttachBrowserAgents method to ChromeBrowserProvider

This method will allow for the creation of embedder-specific methods that are
tied to a specific Browser.

Bug: 790886
Change-Id: I4fdf5b33c45910fe96eff834fc66843328ca05ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838263Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728532}
parent 83a27d8c
......@@ -40,6 +40,7 @@ source_set("main") {
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/infobars:feature_flags",
"//ios/chrome/browser/web_state_list",
"//ios/public/provider/chrome/browser",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
......
......@@ -10,6 +10,7 @@
#import "ios/chrome/browser/infobars/infobar_badge_browser_agent.h"
#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
#import "ios/chrome/browser/web_state_list/tab_insertion_browser_agent.h"
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -24,4 +25,7 @@ void AttachBrowserAgents(Browser* browser) {
if (base::FeatureList::IsEnabled(kInfobarOverlayUI)) {
InfobarBadgeBrowserAgent::CreateForBrowser(browser);
}
// This needs to be called last in case any downstream browser agents need to
// access upstream agents created earlier in this function.
ios::GetChromeBrowserProvider()->AttachBrowserAgents(browser);
}
......@@ -40,6 +40,7 @@ class GURL;
@protocol LogoVendor;
@class UITextField;
@class UIView;
class Browser;
namespace ios {
......@@ -120,6 +121,9 @@ class ChromeBrowserProvider {
// Attaches any embedder-specific tab helpers to the given |web_state|.
virtual void AttachTabHelpers(web::WebState* web_state) const;
// Attaches any embedder-specific browser agents to the given |browser|.
virtual void AttachBrowserAgents(Browser* browser) const;
// Returns an instance of the voice search provider, if one exists.
virtual VoiceSearchProvider* GetVoiceSearchProvider() const;
......
......@@ -84,6 +84,8 @@ UITextField* ChromeBrowserProvider::CreateStyledTextField() const {
void ChromeBrowserProvider::AttachTabHelpers(web::WebState* web_state) const {}
void ChromeBrowserProvider::AttachBrowserAgents(Browser* browser) const {}
VoiceSearchProvider* ChromeBrowserProvider::GetVoiceSearchProvider() const {
return nullptr;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment