| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 27 #include "components/rappor/rappor_service.h" | 27 #include "components/rappor/rappor_service.h" |
| 28 #include "components/task_scheduler_util/initialization_util.h" | 28 #include "components/task_scheduler_util/initialization_util.h" |
| 29 #include "components/translate/core/browser/translate_download_manager.h" | 29 #include "components/translate/core/browser/translate_download_manager.h" |
| 30 #include "components/variations/field_trial_config/field_trial_util.h" | 30 #include "components/variations/field_trial_config/field_trial_util.h" |
| 31 #include "components/variations/service/variations_service.h" | 31 #include "components/variations/service/variations_service.h" |
| 32 #include "components/variations/variations_http_header_provider.h" | 32 #include "components/variations/variations_http_header_provider.h" |
| 33 #include "components/variations/variations_switches.h" | 33 #include "components/variations/variations_switches.h" |
| 34 #include "ios/chrome/browser/about_flags.h" | 34 #include "ios/chrome/browser/about_flags.h" |
| 35 #include "ios/chrome/browser/application_context_impl.h" | 35 #include "ios/chrome/browser/application_context_impl.h" |
| 36 #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories
.h" |
| 36 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 37 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 37 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" | 38 #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" |
| 38 #include "ios/chrome/browser/chrome_paths.h" | 39 #include "ios/chrome/browser/chrome_paths.h" |
| 39 #include "ios/chrome/browser/chrome_switches.h" | 40 #include "ios/chrome/browser/chrome_switches.h" |
| 40 #include "ios/chrome/browser/chrome_url_constants.h" | 41 #include "ios/chrome/browser/chrome_url_constants.h" |
| 41 #import "ios/chrome/browser/first_run/first_run.h" | 42 #import "ios/chrome/browser/first_run/first_run.h" |
| 42 #include "ios/chrome/browser/install_time_util.h" | 43 #include "ios/chrome/browser/install_time_util.h" |
| 43 #include "ios/chrome/browser/ios_chrome_field_trials.h" | 44 #include "ios/chrome/browser/ios_chrome_field_trials.h" |
| 44 #include "ios/chrome/browser/metrics/field_trial_synchronizer.h" | 45 #include "ios/chrome/browser/metrics/field_trial_synchronizer.h" |
| 45 #include "ios/chrome/browser/open_from_clipboard/create_clipboard_recent_content
.h" | 46 #include "ios/chrome/browser/open_from_clipboard/create_clipboard_recent_content
.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // ContentSettingsPattern need to be initialized before creating the | 158 // ContentSettingsPattern need to be initialized before creating the |
| 158 // ChromeBrowserState. | 159 // ChromeBrowserState. |
| 159 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | 160 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( |
| 160 kDummyExtensionScheme); | 161 kDummyExtensionScheme); |
| 161 | 162 |
| 162 // Ensure ClipboadRecentContentIOS is created. | 163 // Ensure ClipboadRecentContentIOS is created. |
| 163 ClipboardRecentContent::SetInstance( | 164 ClipboardRecentContent::SetInstance( |
| 164 CreateClipboardRecentContentIOS().release()); | 165 CreateClipboardRecentContentIOS().release()); |
| 165 | 166 |
| 166 // Ensure that the browser state is initialized. | 167 // Ensure that the browser state is initialized. |
| 168 EnsureBrowserStateKeyedServiceFactoriesBuilt(); |
| 167 ios::GetChromeBrowserProvider()->AssertBrowserContextKeyedFactoriesBuilt(); | 169 ios::GetChromeBrowserProvider()->AssertBrowserContextKeyedFactoriesBuilt(); |
| 168 ios::ChromeBrowserStateManager* browser_state_manager = | 170 ios::ChromeBrowserStateManager* browser_state_manager = |
| 169 application_context_->GetChromeBrowserStateManager(); | 171 application_context_->GetChromeBrowserStateManager(); |
| 170 ios::ChromeBrowserState* last_used_browser_state = | 172 ios::ChromeBrowserState* last_used_browser_state = |
| 171 browser_state_manager->GetLastUsedBrowserState(); | 173 browser_state_manager->GetLastUsedBrowserState(); |
| 172 | 174 |
| 173 #if defined(ENABLE_RLZ) | 175 #if defined(ENABLE_RLZ) |
| 174 // Init the RLZ library. This just schedules a task on the file thread to be | 176 // Init the RLZ library. This just schedules a task on the file thread to be |
| 175 // run sometime later. If this is the first run we record the installation | 177 // run sometime later. If this is the first run we record the installation |
| 176 // event. | 178 // event. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 301 |
| 300 void IOSChromeMainParts::StartMetricsRecording() { | 302 void IOSChromeMainParts::StartMetricsRecording() { |
| 301 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); | 303 bool wifiOnly = local_state_->GetBoolean(prefs::kMetricsReportingWifiOnly); |
| 302 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( | 304 bool isConnectionCellular = net::NetworkChangeNotifier::IsConnectionCellular( |
| 303 net::NetworkChangeNotifier::GetConnectionType()); | 305 net::NetworkChangeNotifier::GetConnectionType()); |
| 304 bool mayUpload = !wifiOnly || !isConnectionCellular; | 306 bool mayUpload = !wifiOnly || !isConnectionCellular; |
| 305 | 307 |
| 306 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( | 308 application_context_->GetMetricsServicesManager()->UpdateUploadPermissions( |
| 307 mayUpload); | 309 mayUpload); |
| 308 } | 310 } |
| OLD | NEW |