| 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_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "chrome/browser/history/history_types.h" | 15 #include "chrome/browser/history/history_types.h" |
| 16 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" | 16 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
| 17 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 18 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 21 | 22 |
| 22 struct AutocompleteLog; | 23 struct AutocompleteLog; |
| 23 struct AutocompleteMatch; | 24 struct AutocompleteMatch; |
| 24 class AutocompleteResult; | 25 class AutocompleteResult; |
| 25 class HistoryService; | 26 class HistoryService; |
| 26 class PredictorsHandler; | 27 class PredictorsHandler; |
| 27 class Profile; | 28 class Profile; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // is then mapped to an Action. | 91 // is then mapped to an Action. |
| 91 Action RecommendAction(const string16& user_text, | 92 Action RecommendAction(const string16& user_text, |
| 92 const AutocompleteMatch& match) const; | 93 const AutocompleteMatch& match) const; |
| 93 | 94 |
| 94 // Begin prerendering |url| with |session_storage_namespace|. The |size| gives | 95 // Begin prerendering |url| with |session_storage_namespace|. The |size| gives |
| 95 // the initial size for the target prerender. The predictor will run at most | 96 // the initial size for the target prerender. The predictor will run at most |
| 96 // one prerender at a time, so launching a prerender will cancel our previous | 97 // one prerender at a time, so launching a prerender will cancel our previous |
| 97 // prerenders (if any). | 98 // prerenders (if any). |
| 98 void StartPrerendering( | 99 void StartPrerendering( |
| 99 const GURL& url, | 100 const GURL& url, |
| 100 content::SessionStorageNamespace* session_storage_namespace, | 101 const content::SessionStorageNamespaceMap& session_storage_namespace_map, |
| 101 const gfx::Size& size); | 102 const gfx::Size& size); |
| 102 | 103 |
| 103 // Return true if the suggestion type warrants a TCP/IP preconnection. | 104 // Return true if the suggestion type warrants a TCP/IP preconnection. |
| 104 // i.e., it is now quite likely that the user will select the related domain. | 105 // i.e., it is now quite likely that the user will select the related domain. |
| 105 static bool IsPreconnectable(const AutocompleteMatch& match); | 106 static bool IsPreconnectable(const AutocompleteMatch& match); |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 friend class AutocompleteActionPredictorTest; | 109 friend class AutocompleteActionPredictorTest; |
| 109 friend class ::PredictorsHandler; | 110 friend class ::PredictorsHandler; |
| 110 | 111 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 DBIdCacheMap db_id_cache_; | 233 DBIdCacheMap db_id_cache_; |
| 233 | 234 |
| 234 bool initialized_; | 235 bool initialized_; |
| 235 | 236 |
| 236 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); | 237 DISALLOW_COPY_AND_ASSIGN(AutocompleteActionPredictor); |
| 237 }; | 238 }; |
| 238 | 239 |
| 239 } // namespace predictors | 240 } // namespace predictors |
| 240 | 241 |
| 241 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ | 242 #endif // CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ |
| OLD | NEW |