Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: ios/chrome/browser/physical_web/start_physical_web_discovery.mm

Issue 2725803007: Extend Physical Web iOS auto-enable behavior beyond first launch. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/search_engines/search_terms_data.h" 10 #include "components/search_engines/search_terms_data.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 URLHasEligibleDomain:GURL("https://www.google.com")]; 52 URLHasEligibleDomain:GURL("https://www.google.com")];
53 53
54 // Check that Google Search is configured as the default search engine. 54 // Check that Google Search is configured as the default search engine.
55 const TemplateURL* default_search_provider = 55 const TemplateURL* default_search_provider =
56 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state) 56 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state)
57 ->GetDefaultSearchProvider(); 57 ->GetDefaultSearchProvider();
58 bool google_search_enabled = 58 bool google_search_enabled =
59 default_search_provider->IsGoogleSearchURLWithReplaceableKeyword( 59 default_search_provider->IsGoogleSearchURLWithReplaceableKeyword(
60 SearchTermsData()); 60 SearchTermsData());
61 61
62 bool auto_enable = !is_incognito && location_services_enabled && 62 if (!is_incognito && location_services_enabled && location_authorized &&
63 location_authorized && geolocation_eligible && 63 geolocation_eligible && google_search_enabled) {
64 google_search_enabled; 64 pref_service->SetInteger(prefs::kIosPhysicalWebEnabled,
65 65 physical_web::kPhysicalWebOn);
66 pref_service->SetInteger(prefs::kIosPhysicalWebEnabled, 66 }
67 auto_enable ? physical_web::kPhysicalWebOn
68 : physical_web::kPhysicalWebOff);
69 preference_state = pref_service->GetInteger(prefs::kIosPhysicalWebEnabled); 67 preference_state = pref_service->GetInteger(prefs::kIosPhysicalWebEnabled);
70 } 68 }
71 69
72 // Scan only if the feature is enabled. 70 // Scan only if the feature is enabled.
73 if (preference_state == physical_web::kPhysicalWebOn) { 71 if (preference_state == physical_web::kPhysicalWebOn) {
74 GetApplicationContext()->GetPhysicalWebDataSource()->StartDiscovery(true); 72 GetApplicationContext()->GetPhysicalWebDataSource()->StartDiscovery(true);
75 } else { 73 } else {
76 GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery(); 74 GetApplicationContext()->GetPhysicalWebDataSource()->StopDiscovery();
77 } 75 }
78 } 76 }
79 77
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698