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/ios_chrome_main_parts.h" | 5 #include "ios/chrome/browser/ios_chrome_main_parts.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/metrics/user_metrics.h" | 12 #include "base/metrics/user_metrics.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
15 #include "components/content_settings/core/browser/cookie_settings.h" | 15 #include "components/content_settings/core/browser/cookie_settings.h" |
16 #include "components/content_settings/core/common/content_settings_pattern.h" | 16 #include "components/content_settings/core/common/content_settings_pattern.h" |
17 #include "components/flags_ui/pref_service_flags_storage.h" | 17 #include "components/flags_ui/pref_service_flags_storage.h" |
18 #include "components/language_usage_metrics/language_usage_metrics.h" | 18 #include "components/language_usage_metrics/language_usage_metrics.h" |
19 #include "components/metrics/metrics_service.h" | 19 #include "components/metrics/metrics_service.h" |
20 #include "components/metrics/profiler/ios/ios_tracking_synchronizer_delegate.h" | 20 #include "components/metrics/profiler/ios/ios_tracking_synchronizer_delegate.h" |
21 #include "components/metrics/profiler/tracking_synchronizer.h" | 21 #include "components/metrics/profiler/tracking_synchronizer.h" |
22 #include "components/metrics_services_manager/metrics_services_manager.h" | 22 #include "components/metrics_services_manager/metrics_services_manager.h" |
23 #include "components/open_from_clipboard/clipboard_recent_content.h" | 23 #include "components/open_from_clipboard/clipboard_recent_content.h" |
24 #include "components/physical_web_data_source/physical_web_data_source.h" | |
24 #include "components/prefs/json_pref_store.h" | 25 #include "components/prefs/json_pref_store.h" |
25 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
26 #include "components/rappor/rappor_service.h" | 27 #include "components/rappor/rappor_service.h" |
27 #include "components/translate/core/browser/translate_download_manager.h" | 28 #include "components/translate/core/browser/translate_download_manager.h" |
28 #include "components/variations/service/variations_service.h" | 29 #include "components/variations/service/variations_service.h" |
29 #include "components/variations/variations_http_header_provider.h" | 30 #include "components/variations/variations_http_header_provider.h" |
30 #include "ios/chrome/browser/about_flags.h" | 31 #include "ios/chrome/browser/about_flags.h" |
31 #include "ios/chrome/browser/application_context_impl.h" | 32 #include "ios/chrome/browser/application_context_impl.h" |
32 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 33 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
33 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" | 34 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
34 #include "ios/chrome/browser/chrome_paths.h" | 35 #include "ios/chrome/browser/chrome_paths.h" |
35 #include "ios/chrome/browser/chrome_switches.h" | 36 #include "ios/chrome/browser/chrome_switches.h" |
36 #include "ios/chrome/browser/chrome_url_constants.h" | 37 #include "ios/chrome/browser/chrome_url_constants.h" |
37 #import "ios/chrome/browser/first_run/first_run.h" | 38 #import "ios/chrome/browser/first_run/first_run.h" |
38 #include "ios/chrome/browser/install_time_util.h" | 39 #include "ios/chrome/browser/install_time_util.h" |
39 #include "ios/chrome/browser/ios_chrome_field_trials.h" | 40 #include "ios/chrome/browser/ios_chrome_field_trials.h" |
40 #include "ios/chrome/browser/metrics/field_trial_synchronizer.h" | 41 #include "ios/chrome/browser/metrics/field_trial_synchronizer.h" |
41 #include "ios/chrome/browser/open_from_clipboard/create_clipboard_recent_content .h" | 42 #include "ios/chrome/browser/open_from_clipboard/create_clipboard_recent_content .h" |
43 #include "ios/chrome/browser/physical_web/create_physical_web_data_source.h" | |
42 #include "ios/chrome/browser/pref_names.h" | 44 #include "ios/chrome/browser/pref_names.h" |
43 #include "ios/chrome/browser/translate/translate_service_ios.h" | 45 #include "ios/chrome/browser/translate/translate_service_ios.h" |
44 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 46 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
45 #include "ios/web/public/web_thread.h" | 47 #include "ios/web/public/web_thread.h" |
46 #include "net/base/network_change_notifier.h" | 48 #include "net/base/network_change_notifier.h" |
47 #include "net/http/http_network_layer.h" | 49 #include "net/http/http_network_layer.h" |
48 #include "net/http/http_stream_factory.h" | 50 #include "net/http/http_stream_factory.h" |
49 #include "net/url_request/url_request.h" | 51 #include "net/url_request/url_request.h" |
50 #include "ui/base/l10n/l10n_util_mac.h" | 52 #include "ui/base/l10n/l10n_util_mac.h" |
51 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 | 131 |
130 // ContentSettingsPattern need to be initialized before creating the | 132 // ContentSettingsPattern need to be initialized before creating the |
131 // ChromeBrowserState. | 133 // ChromeBrowserState. |
132 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | 134 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( |
133 kDummyExtensionScheme); | 135 kDummyExtensionScheme); |
134 | 136 |
135 // Ensure ClipboadRecentContentIOS is created. | 137 // Ensure ClipboadRecentContentIOS is created. |
136 ClipboardRecentContent::SetInstance( | 138 ClipboardRecentContent::SetInstance( |
137 CreateClipboardRecentContentIOS().release()); | 139 CreateClipboardRecentContentIOS().release()); |
138 | 140 |
141 // Ensure PhysicalWebDataSourceIOS is created. | |
142 PhysicalWebDataSource::SetInstance( | |
Olivier
2016/06/30 08:14:11
Do we want to create this object if the experiment
mattreynolds
2016/06/30 17:51:58
Done.
| |
143 CreatePhysicalWebDataSourceIOS().release()); | |
144 | |
139 // Ensure that the browser state is initialized. | 145 // Ensure that the browser state is initialized. |
140 ios::GetChromeBrowserProvider()->AssertBrowserContextKeyedFactoriesBuilt(); | 146 ios::GetChromeBrowserProvider()->AssertBrowserContextKeyedFactoriesBuilt(); |
141 ios::ChromeBrowserStateManager* browser_state_manager = | 147 ios::ChromeBrowserStateManager* browser_state_manager = |
142 application_context_->GetChromeBrowserStateManager(); | 148 application_context_->GetChromeBrowserStateManager(); |
143 ios::ChromeBrowserState* last_used_browser_state = | 149 ios::ChromeBrowserState* last_used_browser_state = |
144 browser_state_manager->GetLastUsedBrowserState(); | 150 browser_state_manager->GetLastUsedBrowserState(); |
145 | 151 |
146 #if defined(ENABLE_RLZ) | 152 #if defined(ENABLE_RLZ) |
147 // Init the RLZ library. This just schedules a task on the file thread to be | 153 // Init the RLZ library. This just schedules a task on the file thread to be |
148 // run sometime later. If this is the first run we record the installation | 154 // run sometime later. If this is the first run we record the installation |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 | 253 |
248 void IOSChromeMainParts::StartMetricsRecording() { | 254 void IOSChromeMainParts::StartMetricsRecording() { |
249 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); | 255 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); |
250 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( | 256 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( |
251 net::NetworkChangeNotifier::GetConnectionType()); | 257 net::NetworkChangeNotifier::GetConnectionType()); |
252 bool mayUpload = !wifiOnly || !isConnectionCellular; | 258 bool mayUpload = !wifiOnly || !isConnectionCellular; |
253 | 259 |
254 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( | 260 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( |
255 mayUpload); | 261 mayUpload); |
256 } | 262 } |
OLD | NEW |