summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-09 03:58:39 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-09 03:58:39 +0000
commitf74d7ed2fd9792ed79b26a6512e7ba3df5f90eef (patch)
tree48eedd432d2b0c3076d2fac02921eb631d8aafcc
parentc1a34f68b17990ed4ef7f3c98ebabb417da77152 (diff)
downloadchromium_src-f74d7ed2fd9792ed79b26a6512e7ba3df5f90eef.zip
chromium_src-f74d7ed2fd9792ed79b26a6512e7ba3df5f90eef.tar.gz
chromium_src-f74d7ed2fd9792ed79b26a6512e7ba3df5f90eef.tar.bz2
Revert 249982 "Omnibox: Pass Input Box Type to AutocompleteClass..."
> Omnibox: Pass Input Box Type to AutocompleteClassifier > > (where possible and reasonable) > > This is a resubmission of https://codereview.chromium.org/138173007/ > that should have fixed the gtk compile error. > > > Previously, the input box type (a.k.a. current page classification) > (search results page doing search term replacement, arbitrary URL, > new tab page omnibox, new tab page fakebox, etc.) was not passed to > AutocompleteClassifier. This adds plumbing to pass the variable to > the classifier in some cases. (Some other cases I decided were too > much of a hassle to fix, and not important.) > > TBR=brettw,pkasting > brettw: > for changes to chrome/browser/tab_contents/render_view_context_menu.cc > pkasting: > because he already reviewed it > > BUG=265678 > > Review URL: https://codereview.chromium.org/157033005 TBR=mpearson@chromium.org Review URL: https://codereview.chromium.org/158433003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249984 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_classifier.cc14
-rw-r--r--chrome/browser/autocomplete/autocomplete_classifier.h17
-rw-r--r--chrome/browser/autocomplete/search_provider.cc3
-rw-r--r--chrome/browser/autocomplete/zero_suggest_provider.cc2
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc4
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm4
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc4
-rw-r--r--chrome/browser/ui/omnibox/omnibox_edit_model.cc10
-rw-r--r--chrome/browser/ui/views/frame/browser_root_view.cc5
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc3
11 files changed, 26 insertions, 44 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_classifier.cc b/chrome/browser/autocomplete/autocomplete_classifier.cc
index 99dafbf..b8169ad 100644
--- a/chrome/browser/autocomplete/autocomplete_classifier.cc
+++ b/chrome/browser/autocomplete/autocomplete_classifier.cc
@@ -33,18 +33,16 @@ AutocompleteClassifier::~AutocompleteClassifier() {
DCHECK(!controller_.get());
}
-void AutocompleteClassifier::Classify(
- const base::string16& text,
- bool prefer_keyword,
- bool allow_exact_keyword_match,
- AutocompleteInput::PageClassification page_classification,
- AutocompleteMatch* match,
- GURL* alternate_nav_url) {
+void AutocompleteClassifier::Classify(const base::string16& text,
+ bool prefer_keyword,
+ bool allow_exact_keyword_match,
+ AutocompleteMatch* match,
+ GURL* alternate_nav_url) {
DCHECK(!inside_classify_);
base::AutoReset<bool> reset(&inside_classify_, true);
controller_->Start(AutocompleteInput(
text, base::string16::npos, base::string16(), GURL(),
- page_classification, true, prefer_keyword,
+ AutocompleteInput::INVALID_SPEC, true, prefer_keyword,
allow_exact_keyword_match, AutocompleteInput::BEST_MATCH));
DCHECK(controller_->done());
const AutocompleteResult& result = controller_->result();
diff --git a/chrome/browser/autocomplete/autocomplete_classifier.h b/chrome/browser/autocomplete/autocomplete_classifier.h
index 7ec95f5..8e9c760 100644
--- a/chrome/browser/autocomplete/autocomplete_classifier.h
+++ b/chrome/browser/autocomplete/autocomplete_classifier.h
@@ -9,7 +9,6 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
class AutocompleteController;
@@ -33,20 +32,16 @@ class AutocompleteClassifier : public BrowserContextKeyedService {
// comments on AutocompleteController::Start().
// |allow_exact_keyword_match| should be true when treating the string as a
// potential keyword search is valid; see
- // AutocompleteInput::allow_exact_keyword_match().
- // |page_classification| gives information about the context (e.g., is the
- // user on a search results page doing search term replacement); this may
- // be useful in deciding how the input should be interpreted.
- // |match| should be a non-NULL outparam that will be set to the default
- // match for this input, if any (for invalid input, there will be no default
- // match, and |match| will be left unchanged). |alternate_nav_url| is a
- // possibly-NULL outparam that, if non-NULL, will be set to the navigational
- // URL (if any) in case of an accidental search; see comments on
+ // AutocompleteInput::allow_exact_keyword_match(). |match| should be a
+ // non-NULL outparam that will be set to the default match for this input, if
+ // any (for invalid input, there will be no default match, and |match| will be
+ // left unchanged). |alternate_nav_url| is a possibly-NULL outparam that, if
+ // non-NULL, will be set to the navigational URL (if any) in case of an
+ // accidental search; see comments on
// AutocompleteResult::alternate_nav_url_ in autocomplete.h.
void Classify(const base::string16& text,
bool prefer_keyword,
bool allow_exact_keyword_match,
- AutocompleteInput::PageClassification page_classification,
AutocompleteMatch* match,
GURL* alternate_nav_url);
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index a1ccb9a..909a86f 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -1367,8 +1367,7 @@ SearchProvider::SuggestResults SearchProvider::ScoreHistoryResults(
// anything special.
if (!prevent_inline_autocomplete && classifier && (i->term != input_text)) {
AutocompleteMatch match;
- classifier->Classify(i->term, false, false,
- input_.current_page_classification(), &match, NULL);
+ classifier->Classify(i->term, false, false, &match, NULL);
prevent_inline_autocomplete =
!AutocompleteMatch::IsSearchType(match.type);
}
diff --git a/chrome/browser/autocomplete/zero_suggest_provider.cc b/chrome/browser/autocomplete/zero_suggest_provider.cc
index b6e0722..860fb13 100644
--- a/chrome/browser/autocomplete/zero_suggest_provider.cc
+++ b/chrome/browser/autocomplete/zero_suggest_provider.cc
@@ -441,7 +441,7 @@ AutocompleteMatch ZeroSuggestProvider::MatchForCurrentURL() {
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
- permanent_text_, false, true, current_page_classification_, &match, NULL);
+ permanent_text_, false, true, &match, NULL);
match.is_history_what_you_typed_match = false;
match.allowed_to_be_default_match = true;
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index f2db25e..628d903 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -23,7 +23,6 @@
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -1014,8 +1013,7 @@ void RenderViewContextMenu::AppendSearchProvider() {
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
- params_.selection_text, false, false, AutocompleteInput::INVALID_SPEC,
- &match, NULL);
+ params_.selection_text, false, false, &match, NULL);
selection_navigation_url_ = match.destination_url;
if (!selection_navigation_url_.is_valid())
return;
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 7c33924..c0f788b 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -19,7 +19,6 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/tab_helper.h"
@@ -2087,8 +2086,7 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
// If the input is plain text, classify the input and make the URL.
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
- base::SysNSStringToUTF16(text), false, false, AutocompleteInput::BLANK,
- &match, NULL);
+ base::SysNSStringToUTF16(text), false, false, &match, NULL);
GURL url(match.destination_url);
[self openURL:&url inView:view at:point];
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index 7cb950f..51bd7d9 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -16,7 +16,6 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/command_updater.h"
@@ -801,8 +800,7 @@ class NotificationBridge
// If the input is plain text, classify the input and make the URL.
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(browser_->profile())->Classify(
- base::SysNSStringToUTF16(text), false, false, AutocompleteInput::BLANK,
- &match, NULL);
+ base::SysNSStringToUTF16(text), false, false, &match, NULL);
GURL url(match.destination_url);
OpenURLParams params(
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index 3a5f5be..c267fa5 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -18,7 +18,6 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
@@ -861,8 +860,7 @@ bool URLFromPrimarySelection(Profile* profile, GURL* url) {
// a search query if necessary.
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
- base::UTF8ToUTF16(selection_text), false, false,
- AutocompleteInput::INVALID_SPEC, &match, NULL);
+ base::UTF8ToUTF16(selection_text), false, false, &match, NULL);
g_free(selection_text);
if (!match.destination_url.is_valid())
return false;
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
index dc35335..c01095b 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -466,8 +466,8 @@ void OmniboxEditModel::AdjustTextForCopy(int sel_min,
// the user is probably holding down control to cause the copy, which will
// screw up our calculation of the desired_tld.
AutocompleteMatch match;
- AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
- *text, KeywordIsSelected(), true, ClassifyPage(), &match, NULL);
+ AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(*text,
+ KeywordIsSelected(), true, &match, NULL);
if (AutocompleteMatch::IsSearchType(match.type))
return;
*url = match.destination_url;
@@ -1329,7 +1329,7 @@ void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match,
} else {
AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
UserTextFromDisplayText(view_->GetText()), KeywordIsSelected(), true,
- ClassifyPage(), match, alternate_nav_url);
+ match, alternate_nav_url);
}
}
@@ -1427,8 +1427,8 @@ void OmniboxEditModel::ClassifyStringForPasteAndGo(
AutocompleteMatch* match,
GURL* alternate_nav_url) const {
DCHECK(match);
- AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(
- text, false, false, ClassifyPage(), match, alternate_nav_url);
+ AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
+ false, false, match, alternate_nav_url);
}
void OmniboxEditModel::SetFocusState(OmniboxFocusState state,
diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc
index b5a8fac..f7ddec3f 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -6,7 +6,6 @@
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/profiles/profile.h"
@@ -195,8 +194,8 @@ bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data,
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(
- browser_view_->browser()->profile())->Classify(
- text, false, false, AutocompleteInput::INVALID_SPEC, &match, NULL);
+ browser_view_->browser()->profile())->Classify(text, false, false, &match,
+ NULL);
if (!match.destination_url.is_valid())
return false;
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 0de7501..6661044 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -11,7 +11,6 @@
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -385,7 +384,7 @@ void BrowserTabStripController::CreateNewTabWithLocation(
// a search query if necessary.
AutocompleteMatch match;
AutocompleteClassifierFactory::GetForProfile(profile())->Classify(
- location, false, false, AutocompleteInput::BLANK, &match, NULL);
+ location, false, false, &match, NULL);
if (match.destination_url.is_valid())
model_->delegate()->AddTabAt(match.destination_url, -1, true);
}