cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / google / google_url_tracker_factory.cc
blobec18592b81e67d7097306e5483cf37adceb66f42
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/chrome/browser/google/google_url_tracker_factory.h"
7 #include "base/memory/singleton.h"
8 #include "base/prefs/pref_service.h"
9 #include "components/google/core/browser/google_pref_names.h"
10 #include "components/google/core/browser/google_url_tracker.h"
11 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
12 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
13 #include "ios/chrome/browser/google/google_url_tracker_client_impl.h"
14 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
16 namespace ios {
18 // static
19 GoogleURLTracker* GoogleURLTrackerFactory::GetForBrowserState(
20 ios::ChromeBrowserState* browser_state) {
21 return static_cast<GoogleURLTracker*>(
22 GetInstance()->GetServiceForBrowserState(browser_state, true));
25 // static
26 GoogleURLTrackerFactory* GoogleURLTrackerFactory::GetInstance() {
27 return Singleton<GoogleURLTrackerFactory>::get();
30 GoogleURLTrackerFactory::GoogleURLTrackerFactory()
31 : BrowserStateKeyedServiceFactory(
32 "GoogleURLTracker",
33 BrowserStateDependencyManager::GetInstance()) {
36 GoogleURLTrackerFactory::~GoogleURLTrackerFactory() {
39 scoped_ptr<KeyedService> GoogleURLTrackerFactory::BuildServiceInstanceFor(
40 web::BrowserState* context) const {
41 ios::ChromeBrowserState* browser_state =
42 ios::ChromeBrowserState::FromBrowserState(context);
44 // Delete this now-unused pref.
45 // At some point in the future, this code can be removed entirely.
46 browser_state->GetOriginalChromeBrowserState()->GetPrefs()->ClearPref(
47 prefs::kLastPromptedGoogleURL);
49 return make_scoped_ptr(new GoogleURLTracker(
50 make_scoped_ptr(new GoogleURLTrackerClientImpl(browser_state)),
51 GoogleURLTracker::NORMAL_MODE));
54 web::BrowserState* GoogleURLTrackerFactory::GetBrowserStateToUse(
55 web::BrowserState* context) const {
56 return GetBrowserStateRedirectedInIncognito(context);
59 bool GoogleURLTrackerFactory::ServiceIsCreatedWithBrowserState() const {
60 return true;
63 bool GoogleURLTrackerFactory::ServiceIsNULLWhileTesting() const {
64 return true;
67 void GoogleURLTrackerFactory::RegisterBrowserStatePrefs(
68 user_prefs::PrefRegistrySyncable* registry) {
69 GoogleURLTracker::RegisterProfilePrefs(registry);
72 } // namespace ios