summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:19:18 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:19:18 +0000
commit66ee443252fd759c5e20cb93be1e90a732da0ebe (patch)
tree5ee39c6ee0c62c8feba5103836a36d28203b7b54 /chrome/test
parentcbadedd7a2cdc20a745ff8b51922b2533169f7b0 (diff)
downloadchromium_src-66ee443252fd759c5e20cb93be1e90a732da0ebe.zip
chromium_src-66ee443252fd759c5e20cb93be1e90a732da0ebe.tar.gz
chromium_src-66ee443252fd759c5e20cb93be1e90a732da0ebe.tar.bz2
Show the location bar icon (almost) all the time, and have its contents match what the user is doing.
There are a couple major moving parts here: * Change AutocompletePopupModel::URLsForCurrentText() to InfoForCurrentText() and have it return an AutocompleteMatch, which callers can use to parse out whatever they want. I needed to get at the match type for the current text and found the proliferation of arguments here ridiculous. This had major ripple effects throughout the codebase, including changing the name and location of SearchVersusNavigateClassifier as it no longer had an "is_search" parameter directly, so the name became misleading and too narrow. I also ended up adding a null constructor for AutocompleteMatch because it was too cumbersome otherwise. * Change the name of the "SecurityImageView" (or similar) to reflect its broader purpose, and plumb it to the edit to get an icon instead of to the toolbar model. * Add an AutocompleteMatch::Type to icon mapping function, and use it not only in the new code but also to simplify showing the popup contents. BUG=27570,39725 TEST=An icon should appear next to the address at all times. It should be a globe on non-secure pages, a magnifying glass on the NTP, and a match for whatever the user is typing as he types. Review URL: http://codereview.chromium.org/1457002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/testing_profile.cc6
-rw-r--r--chrome/test/testing_profile.h15
2 files changed, 16 insertions, 5 deletions
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index b0be809..4a7484e 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -237,6 +237,10 @@ void TestingProfile::CreateBookmarkModel(bool delete_file) {
bookmark_bar_model_->Load();
}
+void TestingProfile::CreateAutocompleteClassifier() {
+ autocomplete_classifier_.reset(new AutocompleteClassifier(this));
+}
+
void TestingProfile::CreateWebDataService(bool delete_file) {
if (web_data_service_.get())
web_data_service_->Shutdown();
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index ce1603d..02cf1fd 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -8,6 +8,7 @@
#include "base/base_paths.h"
#include "base/file_util.h"
#include "base/path_service.h"
+#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_prefs.h"
#include "chrome/browser/browser_theme_provider.h"
@@ -58,14 +59,16 @@ class TestingProfile : public Profile {
// BlockUntilBookmarkModelLoaded.
void CreateBookmarkModel(bool delete_file);
+ // Creates an AutocompleteClassifier. If not invoked the
+ // AutocompleteClassifier is NULL.
+ void CreateAutocompleteClassifier();
+
// Creates the webdata service. If |delete_file| is true, the webdata file is
// deleted first, then the WebDataService is created. As TestingProfile
// deletes the directory containing the files used by WebDataService, this
// only matters if you're recreating the WebDataService.
void CreateWebDataService(bool delete_file);
- // Destroys
-
// Blocks until the BookmarkModel finishes loaded. This is NOT invoked from
// CreateBookmarkModel.
void BlockUntilBookmarkModelLoaded();
@@ -127,8 +130,8 @@ class TestingProfile : public Profile {
return NULL;
return GetRequestContext()->GetCookieStore()->GetCookieMonster();
}
- virtual SearchVersusNavigateClassifier* GetSearchVersusNavigateClassifier() {
- return NULL;
+ virtual AutocompleteClassifier* GetAutocompleteClassifier() {
+ return autocomplete_classifier_.get();
}
virtual WebDataService* GetWebDataService(ServiceAccessType access) {
return web_data_service_.get();
@@ -283,6 +286,10 @@ class TestingProfile : public Profile {
// The ProfileSyncService. Created by CreateProfileSyncService.
scoped_ptr<ProfileSyncService> profile_sync_service_;
+ // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier
+ // is invoked.
+ scoped_ptr<AutocompleteClassifier> autocomplete_classifier_;
+
// The WebDataService. Only created if CreateWebDataService is invoked.
scoped_refptr<WebDataService> web_data_service_;