Commit 7d1e59e3 authored by mattreynolds's avatar mattreynolds Committed by Commit bot

Modify StartPhysicalWebDiscovery to take an ios::ChromeBrowserState param

In a future CL, the Physical Web's auto-optin behavior will be modified to
require that Google is configured as the default search provider. This CL
adds a new overload for StartPhysicalWebDiscovery so downstream users can
be modified to use the new signature that provides access to the browser
state, from which we can determine the default search provider.

BUG=630769

Review-Url: https://codereview.chromium.org/2566753002
Cr-Commit-Position: refs/heads/master@{#438003}
parent 030d74f4
......@@ -20,6 +20,7 @@ source_set("physical_web") {
"//components/pref_registry",
"//components/prefs",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/geolocation",
"//ios/chrome/common/physical_web",
"//url",
......
......@@ -7,8 +7,20 @@
#include "components/prefs/pref_service.h"
namespace ios {
class ChromeBrowserState;
}
// Checks the environment and starts Physical Web discovery if the required
// conditions are met.
// Deprecated, use the version below that takes an ios::ChromeBrowserState.
// TODO(mattreynolds): remove once downstream users have been switched to the
// new method.
void StartPhysicalWebDiscovery(PrefService* pref_service, bool is_incognito);
// Checks the environment and starts Physical Web discovery if the required
// conditions are met.
void StartPhysicalWebDiscovery(PrefService* pref_service,
ios::ChromeBrowserState* browser_state);
#endif // IOS_CHROME_BROWSER_PHYSICAL_WEB_START_PHYSICAL_WEB_DISCOVERY_H_
......@@ -8,6 +8,7 @@
#include "components/physical_web/data_source/physical_web_data_source.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/experimental_flags.h"
#import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h"
#include "ios/chrome/browser/physical_web/physical_web_constants.h"
......@@ -58,3 +59,8 @@ void StartPhysicalWebDiscovery(PrefService* pref_service, bool is_incognito) {
GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery();
}
}
void StartPhysicalWebDiscovery(PrefService* pref_service,
ios::ChromeBrowserState* browser_state) {
StartPhysicalWebDiscovery(pref_service, browser_state->IsOffTheRecord());
}
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