android_webview
apps
ash
base
build
build_overrides
buildtools
cc
chrome
chromecast
chromeos
cloud_print
components
about_ui
account_id
android_system_error_page
apdu
arc
assist_ranker
autofill
autofill_assistant
autofill_payments_strings_grdp
autofill_strings_grdp
background_task_scheduler
base32
blocked_content
blocklist
bookmark_bar_strings_grdp
bookmarks
browser_sync
browser_ui
browser_watcher
browsing_data
browsing_data_strings_grdp
captive_portal
cast
cast_certificate
cast_channel
cbor
cdm
certificate_matching
certificate_transparency
chrome_cleaner
chromeos_camera
client_hints
client_update_protocol
cloud_devices
component_updater
components_strings_grd
consent_auditor
constrained_window
content_capture
content_settings
contextual_search
cookie_config
country_codes
crash
crash_strings_grdp
cronet
crx_file
data_reduction_proxy
data_use_measurement
database_utils
dbus
device_event_log
discardable_memory
dom_distiller
dom_distiller_strings_grdp
domain_reliability
download
drive
embedder_support
encrypted_messages
enterprise
error_page
error_page_strings_grdp
exo
external_intents
favicon
favicon_base
feature_engagement
federated_learning
feed
feedback
filename_generation
find_in_page
flags_ui
games
gcm_driver
google
grpc_support
guest_os
guest_view
gwp_asan
handoff
heap_profiling
history
image_fetcher
infobars
invalidation
javascript_dialogs
javascript_dialogs_strings_grdp
js_injection
keep_alive_registry
keyed_service
language
language_usage_metrics
leveldb_proto
link_header_util
location
login
lookalikes
management
management_ios_strings_grdp
management_strings_grdp
media_control
media_message_center
media_router
messages
metal_util
metrics
metrics_services_manager
minidump_uploader
mirroring
module_installer
nacl
navigation_interception
navigation_metrics
net_log
neterror
network_hints
network_session_configurator
network_time
new_or_sad_tab_strings_grdp
ntp_snippets
ntp_snippets_strings_grdp
ntp_tiles
offline_items_collection
offline_pages
omnibox
omnibox_strings_grdp
on_load_script_injector
onc
open_from_clipboard
openscreen_platform
optimization_guide
proto
BUILD.gn
DEPS
OWNERS
README.md
bloom_filter.cc
bloom_filter.h
bloom_filter_unittest.cc
command_line_top_host_provider.cc
command_line_top_host_provider.h
command_line_top_host_provider_unittest.cc
decision_tree_prediction_model.cc
decision_tree_prediction_model.h
decision_tree_prediction_model_unittest.cc
hint_cache.cc
hint_cache.h
hint_cache_unittest.cc
hints_component_info.h
hints_component_util.cc
hints_component_util.h
hints_component_util_unittest.cc
hints_fetcher.cc
hints_fetcher.h
hints_fetcher_factory.cc
hints_fetcher_factory.h
hints_fetcher_unittest.cc
hints_processing_util.cc
hints_processing_util.h
hints_processing_util_unittest.cc
memory_hint.cc
memory_hint.h
optimization_filter.cc
optimization_filter.h
optimization_filter_unittest.cc
optimization_guide_constants.cc
optimization_guide_constants.h
optimization_guide_decider.h
optimization_guide_enums.h
optimization_guide_features.cc
optimization_guide_features.h
optimization_guide_features_unittest.cc
optimization_guide_prefs.cc
optimization_guide_prefs.h
optimization_guide_service.cc
optimization_guide_service.h
optimization_guide_service_observer.h
optimization_guide_service_unittest.cc
optimization_guide_store.cc
optimization_guide_store.h
optimization_guide_store_unittest.cc
optimization_guide_switches.cc
optimization_guide_switches.h
optimization_guide_switches_unittest.cc
optimization_guide_test_util.cc
optimization_guide_test_util.h
optimization_guide_util.cc
optimization_guide_util.h
optimization_metadata.cc
optimization_metadata.h
optimization_metadata_unittest.cc
prediction_model.cc
prediction_model.h
prediction_model_unittest.cc
proto_database_provider_test_base.cc
proto_database_provider_test_base.h
store_update_data.cc
store_update_data.h
store_update_data_unittest.cc
test_hints_component_creator.cc
test_hints_component_creator.h
test_optimization_guide_decider.cc
test_optimization_guide_decider.h
top_host_provider.h
url_pattern_with_wildcards.cc
url_pattern_with_wildcards.h
url_pattern_with_wildcards_unittest.cc
os_crypt
ownership
page_image_annotation
page_info
page_info_strings_grdp
page_load_metrics
paint_preview
password_manager
password_manager_strings_grdp
payments
payments_strings_grdp
pdf
pdf_strings_grdp
performance_manager
permissions
permissions_strings_grdp
plugins
policy
policy_strings_grdp
pref_registry
prefs
prerender
previews
printing
printing_component_strings_grdp
profile_metrics
proxy_config
pwg_encoder
query_parser
query_tiles
quirks
rappor
reading_list
remote_cocoa
renderer_context_menu
reset_password_strings_grdp
resources
rlz
safe_browsing
safe_search_api
safety_check
scheduling_metrics
schema_org
search
search_engines
search_provider_logos
security_interstitials
security_interstitials_strings_grdp
security_state
security_state_strings_grdp
send_tab_to_self
send_tab_to_self_strings_grdp
services
session_manager
sessions
signin
site_isolation
sms_strings_grdp
soda
speech
spellcheck
sqlite_proto
ssl_errors
ssl_errors_strings_grdp
startup_metric_utils
storage_monitor
strictmode
strings
subresource_filter
suggestions
sync
sync_bookmarks
sync_device_info
sync_preferences
sync_sessions
sync_ui_strings_grdp
sync_user_events
system_media_controls
tab_count_metrics
tab_groups
tab_groups_strings_grdp
test
thin_webview
timers
tracing
translate
translate_strings_grdp
ui_devtools
ui_metrics
ukm
undo
undo_strings_grdp
unified_consent
update_client
upload_list
url_formatter
url_matcher
url_pattern_index
user_actions_ui
user_manager
user_prefs
variations
vector_icons
version_info
version_ui
version_ui_strings_grdp
visitedlink
viz
web_cache
web_modal
web_package
web_resource
webapk
webcrypto
webdata
webdata_services
webrtc
webrtc_logging
wifi
zoom
zucchini
.eslintrc.js
BUILD.gn
DEPS
OWNERS
PRESUBMIT.py
README.md
android_system_error_page_strings.grdp
autofill_assistant_strings.grdp
autofill_payments_strings.grdp
autofill_strings.grdp
blocked_content_strings.grdp
bookmark_bar_strings.grdp
bookmark_component_strings.grdp
browsing_data_strings.grdp
components_chromium_strings.grd
components_google_chrome_strings.grd
components_locale_settings.grd
components_settings_strings.grdp
components_strings.grd
crash_strings.grdp
dialog_strings.grdp
dom_distiller_strings.grdp
error_page_strings.grdp
find_in_page_strings.grdp
flags_strings.grdp
history_strings.grdp
javascript_dialogs_strings.grdp
login_dialog_strings.grdp
management_ios_strings.grdp
management_strings.grdp
media_message_center_strings.grdp
new_or_sad_tab_strings.grdp
ntp_snippets_strings.grdp
omnibox_strings.grdp
page_info_strings.grdp
paint_preview_strings.grdp
password_manager_strings.grdp
payments_strings.grdp
pdf_strings.grdp
permissions_strings.grdp
policy_strings.grdp
print_media_strings.grdp
printing_component_strings.grdp
reset_password_strings.grdp
safe_browsing_strings.grdp
security_interstitials_strings.grdp
security_state_strings.grdp
send_tab_to_self_strings.grdp
sms_strings.grdp
ssl_errors_strings.grdp
sync_ui_strings.grdp
tab_groups_strings.grdp
translate_strings.grdp
typemaps.gni
undo_strings.grdp
version_ui_strings.grdp
content
courgette
crypto
dbus
device
docs
extensions
fuchsia
gin
google_apis
google_update
gpu
headless
infra
ios
ipc
jingle
media
mojo
native_client_sdk
net
pdf
ppapi
printing
remoting
rlz
sandbox
services
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
weblayer
.clang-format
.clang-tidy
.eslintrc.js
.git-blame-ignore-revs
.gitattributes
.gitignore
.gn
.vpython
.vpython3
.yapfignore
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
DEPS
DIR_METADATA
ENG_REVIEW_OWNERS
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings

This is the precursor to adding async support for CanApplyOptimization. The hook will be to check after the hints are stored, whether there are any callbacks registered and run through the current CanApplyOptimization by type. Bug: 1036490 Change-Id: Ia28887d324263a3778cacc848272c22d6cc186f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2018703 Commit-Queue: Sophie Chang <sophiechang@chromium.org> Reviewed-by: Tarun Bansal <tbansal@chromium.org> Reviewed-by: Michael Crouse <mcrouse@chromium.org> Cr-Commit-Position: refs/heads/master@{#735710}
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef COMPONENTS_OPTIMIZATION_GUIDE_HINTS_FETCHER_FACTORY_H_
|
|
#define COMPONENTS_OPTIMIZATION_GUIDE_HINTS_FETCHER_FACTORY_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "base/memory/scoped_refptr.h"
|
|
#include "url/gurl.h"
|
|
|
|
class PrefService;
|
|
|
|
namespace network {
|
|
class SharedURLLoaderFactory;
|
|
} // namespace network
|
|
|
|
namespace optimization_guide {
|
|
|
|
class HintsFetcher;
|
|
|
|
// A factory for creating hints fetchers. Mostly used so tests can override
|
|
// what fetchers get used.
|
|
class HintsFetcherFactory {
|
|
public:
|
|
HintsFetcherFactory(
|
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
|
|
const GURL& optimization_guide_service_url,
|
|
PrefService* pref_service);
|
|
HintsFetcherFactory(const HintsFetcherFactory&) = delete;
|
|
HintsFetcherFactory& operator=(const HintsFetcherFactory&) = delete;
|
|
virtual ~HintsFetcherFactory();
|
|
|
|
// Creates a new instance of HintsFetcher. Virtualized for testing so that the
|
|
// testing code can override this to provide a mocked instance.
|
|
virtual std::unique_ptr<HintsFetcher> BuildInstance();
|
|
|
|
protected:
|
|
// The URL Loader Factory that will be used by hints fetchers created by this
|
|
// factory.
|
|
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
|
|
|
|
// The URL for the remote Optimization Guide Service.
|
|
const GURL optimization_guide_service_url_;
|
|
|
|
// A reference to the PrefService for this profile. Not owned.
|
|
PrefService* pref_service_ = nullptr;
|
|
};
|
|
|
|
} // namespace optimization_guide
|
|
|
|
#endif // COMPONENTS_OPTIMIZATION_GUIDE_HINTS_FETCHER_FACTORY_H_
|