| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/physical_web/start_physical_web_discovery.h" | 5 #include "ios/chrome/browser/physical_web/start_physical_web_discovery.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 | 8 |
| 9 #include "components/physical_web/data_source/physical_web_data_source.h" | 9 #include "components/physical_web/data_source/physical_web_data_source.h" |
| 10 #include "ios/chrome/browser/application_context.h" | 10 #include "ios/chrome/browser/application_context.h" |
| 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #import "ios/chrome/browser/experimental_flags.h" | 12 #import "ios/chrome/browser/experimental_flags.h" |
| 12 #import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h" | 13 #import "ios/chrome/browser/geolocation/omnibox_geolocation_config.h" |
| 13 #include "ios/chrome/browser/physical_web/physical_web_constants.h" | 14 #include "ios/chrome/browser/physical_web/physical_web_constants.h" |
| 14 #include "ios/chrome/browser/pref_names.h" | 15 #include "ios/chrome/browser/pref_names.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 void StartPhysicalWebDiscovery(PrefService* pref_service, bool is_incognito) { | 18 void StartPhysicalWebDiscovery(PrefService* pref_service, bool is_incognito) { |
| 18 // Do not scan if the Physical Web feature is disabled by a command line flag | 19 // Do not scan if the Physical Web feature is disabled by a command line flag |
| 19 // or Chrome Variations experiment. | 20 // or Chrome Variations experiment. |
| 20 if (!experimental_flags::IsPhysicalWebEnabled()) { | 21 if (!experimental_flags::IsPhysicalWebEnabled()) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Scan only if the feature is enabled. | 55 // Scan only if the feature is enabled. |
| 55 if (preference_state == physical_web::kPhysicalWebOn) { | 56 if (preference_state == physical_web::kPhysicalWebOn) { |
| 56 GetApplicationContext()->GetPhysicalWebDataSource()->StartDiscovery(true); | 57 GetApplicationContext()->GetPhysicalWebDataSource()->StartDiscovery(true); |
| 57 } else { | 58 } else { |
| 58 GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery(); | 59 GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery(); |
| 59 } | 60 } |
| 60 } | 61 } |
| 62 |
| 63 void StartPhysicalWebDiscovery(PrefService* pref_service, |
| 64 ios::ChromeBrowserState* browser_state) { |
| 65 StartPhysicalWebDiscovery(pref_service, browser_state->IsOffTheRecord()); |
| 66 } |
| OLD | NEW |