Index: ios/chrome/browser/physical_web/start_physical_web_discovery.mm |
diff --git a/ios/chrome/browser/physical_web/start_physical_web_discovery.mm b/ios/chrome/browser/physical_web/start_physical_web_discovery.mm |
index f1b492e337f08485a902588ac4f1b08299e5097c..9a14bc61139abdb46bf3c2b8d3e98c7313964ece 100644 |
--- a/ios/chrome/browser/physical_web/start_physical_web_discovery.mm |
+++ b/ios/chrome/browser/physical_web/start_physical_web_discovery.mm |
@@ -10,7 +10,9 @@ |
#include "ios/chrome/browser/application_context.h" |
#import "ios/chrome/browser/experimental_flags.h" |
#import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h" |
+#import "ios/chrome/browser/physical_web/ios_chrome_physical_web_data_source.h" |
#include "ios/chrome/browser/physical_web/physical_web_constants.h" |
+#import "ios/chrome/browser/physical_web/physical_web_initial_state_recorder.h" |
#include "ios/chrome/browser/pref_names.h" |
#include "url/gurl.h" |
@@ -52,9 +54,19 @@ void StartPhysicalWebDiscovery(PrefService* pref_service, bool is_incognito) { |
} |
// Scan only if the feature is enabled. |
+ PhysicalWebDataSource* data_source = |
+ GetApplicationContext()->GetPhysicalWebDataSource(); |
if (preference_state == physical_web::kPhysicalWebOn) { |
- GetApplicationContext()->GetPhysicalWebDataSource()->StartDiscovery(true); |
+ data_source->StartDiscovery(true); |
} else { |
- GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery(); |
+ data_source->StopDiscovery(); |
} |
-} |
+ |
+ // Configure the data source to record the initial state of settings relevant |
+ // to the Physical Web feature. |
+ IOSChromePhysicalWebDataSource* ios_chrome_data_source = |
+ (IOSChromePhysicalWebDataSource*)data_source; |
mattreynolds
2016/11/04 00:23:07
This is safe since we're in iOS-specific code. The
sdefresne
2016/11/10 13:15:42
Well, the reason you could not find a place with a
mattreynolds
2016/11/11 02:26:10
Thanks! This is much cleaner.
|
+ if (ios_chrome_data_source) { |
+ ios_chrome_data_source->RecordInitialState(pref_service); |
Olivier
2016/11/10 18:08:08
This method is called on every BVC switch. Is it e
mattreynolds
2016/11/11 02:26:10
There's a check in PhysicalWebInitialStateRecorder
|
+ } |
+} |