Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / webui / predictors / predictors_handler.h
blob4089ed93433383a6692621b97297584a92b5d70a
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
10 #include "content/public/browser/web_ui_message_handler.h"
12 namespace base {
13 class ListValue;
16 namespace predictors {
17 class AutocompleteActionPredictor;
18 class ResourcePrefetchPredictor;
21 class Profile;
23 // The handler for Javascript messages for about:predictors.
24 class PredictorsHandler : public content::WebUIMessageHandler {
25 public:
26 explicit PredictorsHandler(Profile* profile);
27 ~PredictorsHandler() override;
29 // WebUIMessageHandler implementation.
30 void RegisterMessages() override;
32 private:
33 // Synchronously fetches the database from AutocompleteActionPredictor and
34 // calls into JS with the resulting DictionaryValue.
35 void RequestAutocompleteActionPredictorDb(const base::ListValue* args);
37 // Fetches stats for the ResourcePrefetchPredictor and returns it as a
38 // DictionaryValue to the JS.
39 void RequestResourcePrefetchPredictorDb(const base::ListValue* args);
41 // Helper for RequestResourcePrefetchPredictorDb.
42 void AddPrefetchDataMapToListValue(
43 const predictors::ResourcePrefetchPredictor::PrefetchDataMap& data_map,
44 base::ListValue* db) const;
46 predictors::AutocompleteActionPredictor* autocomplete_action_predictor_;
47 predictors::ResourcePrefetchPredictor* resource_prefetch_predictor_;
49 DISALLOW_COPY_AND_ASSIGN(PredictorsHandler);
52 #endif // CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_