| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" |
| 10 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
| 11 | 12 |
| 12 namespace base { | 13 namespace base { |
| 13 class ListValue; | 14 class ListValue; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace predictors { | 17 namespace predictors { |
| 17 class AutocompleteActionPredictor; | 18 class AutocompleteActionPredictor; |
| 19 class ResourcePrefetchPredictor; |
| 18 } | 20 } |
| 19 | 21 |
| 20 class Profile; | 22 class Profile; |
| 21 | 23 |
| 22 // The handler for Javascript messages for about:predictors. | 24 // The handler for Javascript messages for about:predictors. |
| 23 class PredictorsHandler : public content::WebUIMessageHandler { | 25 class PredictorsHandler : public content::WebUIMessageHandler { |
| 24 public: | 26 public: |
| 25 explicit PredictorsHandler(Profile* profile); | 27 explicit PredictorsHandler(Profile* profile); |
| 26 virtual ~PredictorsHandler(); | 28 virtual ~PredictorsHandler(); |
| 27 | 29 |
| 28 // WebUIMessageHandler implementation. | 30 // WebUIMessageHandler implementation. |
| 29 virtual void RegisterMessages() OVERRIDE; | 31 virtual void RegisterMessages() OVERRIDE; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // Synchronously fetches the database from AutocompleteActionPredictor and | 34 // Synchronously fetches the database from AutocompleteActionPredictor and |
| 33 // calls into JS with the resulting DictionaryValue. | 35 // calls into JS with the resulting DictionaryValue. |
| 34 void RequestAutocompleteActionPredictorDb(const base::ListValue* args); | 36 void RequestAutocompleteActionPredictorDb(const base::ListValue* args); |
| 35 | 37 |
| 38 // Fetches stats for the ResourcePrefetchPredictor and returns it as a |
| 39 // DictionaryValue to the JS. |
| 40 void RequestResourcePrefetchPredictorDb(const base::ListValue* args); |
| 41 |
| 36 predictors::AutocompleteActionPredictor* autocomplete_action_predictor_; | 42 predictors::AutocompleteActionPredictor* autocomplete_action_predictor_; |
| 43 scoped_refptr<predictors::ResourcePrefetchPredictor> |
| 44 resource_prefetch_predictor_; |
| 37 | 45 |
| 38 DISALLOW_COPY_AND_ASSIGN(PredictorsHandler); | 46 DISALLOW_COPY_AND_ASSIGN(PredictorsHandler); |
| 39 }; | 47 }; |
| 40 | 48 |
| 41 #endif // CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ | 49 #endif // CHROME_BROWSER_UI_WEBUI_PREDICTORS_PREDICTORS_HANDLER_H_ |
| OLD | NEW |