| 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 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
| 48 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
| 49 #include "content/public/browser/render_view_host.h" | 49 #include "content/public/browser/render_view_host.h" |
| 50 #include "content/public/browser/user_metrics.h" | 50 #include "content/public/browser/user_metrics.h" |
| 51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
| 52 #include "googleurl/src/gurl.h" | 52 #include "googleurl/src/gurl.h" |
| 53 #include "googleurl/src/url_util.h" | 53 #include "googleurl/src/url_util.h" |
| 54 #include "third_party/skia/include/core/SkBitmap.h" | 54 #include "third_party/skia/include/core/SkBitmap.h" |
| 55 | 55 |
| 56 using content::UserMetricsAction; | 56 using content::UserMetricsAction; |
| 57 using predictors::AutocompleteActionPredictor; |
| 58 using predictors::AutocompleteActionPredictorFactory; |
| 57 | 59 |
| 58 /////////////////////////////////////////////////////////////////////////////// | 60 /////////////////////////////////////////////////////////////////////////////// |
| 59 // AutocompleteEditController | 61 // AutocompleteEditController |
| 60 | 62 |
| 61 AutocompleteEditController::~AutocompleteEditController() { | 63 AutocompleteEditController::~AutocompleteEditController() { |
| 62 } | 64 } |
| 63 | 65 |
| 64 /////////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////////// |
| 65 // AutocompleteEditModel::State | 67 // AutocompleteEditModel::State |
| 66 | 68 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Confer with the AutocompleteActionPredictor to determine what action, if | 239 // Confer with the AutocompleteActionPredictor to determine what action, if |
| 238 // any, we should take. Get the recommended action here even if we don't | 240 // any, we should take. Get the recommended action here even if we don't |
| 239 // need it so we can get stats for anyone who is opted in to UMA, but only | 241 // need it so we can get stats for anyone who is opted in to UMA, but only |
| 240 // get it if the user has actually typed something to avoid constructing it | 242 // get it if the user has actually typed something to avoid constructing it |
| 241 // before it's needed. Note: This event is triggered as part of startup when | 243 // before it's needed. Note: This event is triggered as part of startup when |
| 242 // the initial tab transitions to the start page. | 244 // the initial tab transitions to the start page. |
| 243 recommended_action = | 245 recommended_action = |
| 244 action_predictor->RecommendAction(user_text_, current_match); | 246 action_predictor->RecommendAction(user_text_, current_match); |
| 245 } | 247 } |
| 246 | 248 |
| 247 UMA_HISTOGRAM_ENUMERATION("NetworkActionPredictor.Action", recommended_action, | 249 UMA_HISTOGRAM_ENUMERATION("AutocompleteActionPredictor.Action", |
| 250 recommended_action, |
| 248 AutocompleteActionPredictor::LAST_PREDICT_ACTION); | 251 AutocompleteActionPredictor::LAST_PREDICT_ACTION); |
| 249 string16 suggested_text; | 252 string16 suggested_text; |
| 250 | 253 |
| 251 if (DoInstant(current_match, &suggested_text)) { | 254 if (DoInstant(current_match, &suggested_text)) { |
| 252 SetSuggestedText(suggested_text, instant_complete_behavior_); | 255 SetSuggestedText(suggested_text, instant_complete_behavior_); |
| 253 } else { | 256 } else { |
| 254 switch (recommended_action) { | 257 switch (recommended_action) { |
| 255 case AutocompleteActionPredictor::ACTION_PRERENDER: | 258 case AutocompleteActionPredictor::ACTION_PRERENDER: |
| 256 DoPrerender(current_match); | 259 DoPrerender(current_match); |
| 257 break; | 260 break; |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC; | 1149 return metrics::OmniboxEventProto_PageClassification_INVALID_SPEC; |
| 1147 const std::string& url = gurl.spec(); | 1150 const std::string& url = gurl.spec(); |
| 1148 if (url == chrome::kChromeUINewTabURL) | 1151 if (url == chrome::kChromeUINewTabURL) |
| 1149 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE; | 1152 return metrics::OmniboxEventProto_PageClassification_NEW_TAB_PAGE; |
| 1150 if (url == chrome::kAboutBlankURL) | 1153 if (url == chrome::kAboutBlankURL) |
| 1151 return metrics::OmniboxEventProto_PageClassification_BLANK; | 1154 return metrics::OmniboxEventProto_PageClassification_BLANK; |
| 1152 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) | 1155 if (url == profile()->GetPrefs()->GetString(prefs::kHomePage)) |
| 1153 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE; | 1156 return metrics::OmniboxEventProto_PageClassification_HOMEPAGE; |
| 1154 return metrics::OmniboxEventProto_PageClassification_OTHER; | 1157 return metrics::OmniboxEventProto_PageClassification_OTHER; |
| 1155 } | 1158 } |
| OLD | NEW |