| Index: chrome/browser/search/instant_service.cc
|
| diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
|
| index 4a1c3b142c8ca4076e58b0b8ee88481487c72826..4ba48bb4fb818caa5c67b2485c14c7b3fa32bd97 100644
|
| --- a/chrome/browser/search/instant_service.cc
|
| +++ b/chrome/browser/search/instant_service.cc
|
| @@ -5,9 +5,12 @@
|
| #include "chrome/browser/search/instant_service.h"
|
|
|
| #include <stddef.h>
|
| +#include <string>
|
| +#include <utility>
|
|
|
| #include "base/bind.h"
|
| #include "base/feature_list.h"
|
| +#include "base/json/json_reader.h"
|
| #include "build/build_config.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/favicon/fallback_icon_service_factory.h"
|
| @@ -33,6 +36,7 @@
|
| #include "chrome/browser/ui/webui/theme_source.h"
|
| #include "chrome/common/render_messages.h"
|
| #include "chrome/grit/theme_resources.h"
|
| +#include "components/doodle/doodle_fetcher.h"
|
| #include "components/favicon/core/fallback_icon_service.h"
|
| #include "components/favicon/core/large_icon_service.h"
|
| #include "components/history/core/browser/top_sites.h"
|
| @@ -62,6 +66,19 @@ namespace {
|
| const base::Feature kNtpTilesFeature{"NTPTilesInInstantService",
|
| base::FEATURE_DISABLED_BY_DEFAULT};
|
|
|
| +void ParseJson(
|
| + const std::string& json,
|
| + const base::Callback<void(std::unique_ptr<base::Value>)>& success_callback,
|
| + const base::Callback<void(const std::string&)>& error_callback) {
|
| + base::JSONReader json_reader;
|
| + std::unique_ptr<base::Value> value = json_reader.ReadToValue(json);
|
| + if (value) {
|
| + success_callback.Run(std::move(value));
|
| + } else {
|
| + error_callback.Run(json_reader.GetErrorMessage());
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| InstantService::InstantService(Profile* profile)
|
| @@ -148,6 +165,20 @@ InstantService::InstantService(Profile* profile)
|
| content::URLDataSource::Add(
|
| profile_, new LargeIconSource(fallback_icon_service, large_icon_service));
|
| content::URLDataSource::Add(profile_, new MostVisitedIframeSource());
|
| +
|
| + DoodleFetcher doodle_fetcher(profile_->GetRequestContext(),
|
| + base::Bind(ParseJson));
|
| + LOG(ERROR) << "DEBUG DoodleFetcher: Fetcher created.";
|
| + doodle_fetcher.FetchDoodle(base::Bind([](DoodleConfig config) {
|
| + if (config.error_during_fetch) {
|
| + LOG(ERROR) << "DEBUG DoodleFetcher: Error during fetch.";
|
| + }
|
| + LOG(ERROR) << "DEBUG DoodleFetcher: config.search_url="
|
| + << config.search_url;
|
| + LOG(ERROR) << "DEBUG DoodleFetcher: config.large_image.url="
|
| + << config.large_image.url;
|
| + }));
|
| + LOG(ERROR) << "DEBUG DoodleFetcher: Fetch started.";
|
| }
|
|
|
| InstantService::~InstantService() {
|
|
|