diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-03 22:17:11 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-03 22:17:11 +0000 |
commit | b76ac717179aa1e2c4425783a2386b7fb4b9535c (patch) | |
tree | 74ed8bb871877927767deef1fcd4b615aedb6978 | |
parent | 38ba5bd7a0c7770e95aea6619174a953e5d92796 (diff) | |
download | chromium_src-b76ac717179aa1e2c4425783a2386b7fb4b9535c.zip chromium_src-b76ac717179aa1e2c4425783a2386b7fb4b9535c.tar.gz chromium_src-b76ac717179aa1e2c4425783a2386b7fb4b9535c.tar.bz2 |
autocomplete: Move AutocompleteEditView/autocomplete_edit_view.* to ui/omnibox directory.
- Rename AutocompleteEditView to OmniboxView.
- Move autocomplete_edit_view.* to omnibox_view.*
BUG=80186
TEST=None
R=pkasting@chromium.org
Review URL: http://codereview.chromium.org/6912026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83977 0039d316-1c4b-4281-b951-d872f2087c98
39 files changed, 427 insertions, 432 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index c70f8a82..888b5c5 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -7,7 +7,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/history/history.h" @@ -15,6 +14,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/url_constants.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 524ef9d..5c989d0 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -12,7 +12,6 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/autocomplete/autocomplete_popup_view.h" @@ -28,6 +27,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/url_constants.h" #include "content/browser/user_metrics.h" @@ -62,7 +62,7 @@ AutocompleteEditModel::State::~State() { // AutocompleteEditModel AutocompleteEditModel::AutocompleteEditModel( - AutocompleteEditView* view, + OmniboxView* view, AutocompleteEditController* controller, Profile* profile) : ALLOW_THIS_IN_INITIALIZER_LIST( diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index 620caeb..3b40f7b 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -19,10 +19,10 @@ class AutocompleteController; class AutocompleteEditController; class AutocompleteEditModel; -class AutocompleteEditView; class AutocompletePopupModel; class AutocompleteResult; class InstantController; +class OmniboxView; class Profile; class SkBitmap; class TabContentsWrapper; @@ -55,7 +55,7 @@ class AutocompleteEditController { // status of any keyword- or hint-related state. virtual void OnChanged() = 0; - // Called when the selection of the AutocompleteEditView changes. + // Called when the selection of the OmniboxView changes. virtual void OnSelectionBoundsChanged() = 0; // Called whenever the user starts or stops an input session (typing, @@ -100,7 +100,7 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate { const bool is_keyword_hint; }; - AutocompleteEditModel(AutocompleteEditView* view, + AutocompleteEditModel(OmniboxView* view, AutocompleteEditController* controller, Profile* profile); ~AutocompleteEditModel(); @@ -318,9 +318,9 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate { const string16& keyword, bool is_keyword_hint); - // Called by the AutocompleteEditView after something changes, with details - // about what state changes occured. Updates internal state, updates the - // popup if necessary, and returns true if any significant changes occurred. + // Called by the OmniboxView after something changes, with details about what + // state changes occured. Updates internal state, updates the popup if + // necessary, and returns true if any significant changes occurred. // If |allow_keyword_ui_change| is false then the change should not affect // keyword ui state, even if the text matches a keyword exactly. This value // may be false when the user is composing a text with an IME. @@ -439,7 +439,7 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate { scoped_ptr<AutocompleteController> autocomplete_controller_; - AutocompleteEditView* view_; + OmniboxView* view_; AutocompletePopupModel* popup_; diff --git a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc index 5f0236e..d6b9844 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc @@ -4,17 +4,17 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_profile.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" namespace { -class TestingAutocompleteEditView : public AutocompleteEditView { +class TestingOmniboxView : public OmniboxView { public: - TestingAutocompleteEditView() {} + TestingOmniboxView() {} virtual AutocompleteEditModel* model() { return NULL; } virtual const AutocompleteEditModel* model() const { return NULL; } @@ -68,7 +68,7 @@ class TestingAutocompleteEditView : public AutocompleteEditView { #endif private: - DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditView); + DISALLOW_COPY_AND_ASSIGN(TestingOmniboxView); }; class TestingAutocompleteEditController : public AutocompleteEditController { @@ -138,7 +138,7 @@ TEST(AutocompleteEditTest, AdjustTextForCopy) { { "a.b/", 0, false, "http://a.b/", "http://a.b/", true, "http://a.b/" }, }; ScopedTestingBrowserProcess browser_process; - TestingAutocompleteEditView view; + TestingOmniboxView view; TestingAutocompleteEditController controller; TestingProfile profile; AutocompleteEditModel model(&view, &controller, &profile); diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/autocomplete/autocomplete_popup_model.h index cb67674..fc971aa 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.h +++ b/chrome/browser/autocomplete/autocomplete_popup_model.h @@ -10,7 +10,6 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -class AutocompleteEditView; class AutocompletePopupView; class Profile; class SkBitmap; diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc index 26a5695..e32a05a 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc @@ -16,7 +16,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/defaults.h" @@ -25,6 +24,7 @@ #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "content/common/notification_service.h" #include "grit/theme_resources.h" #include "ui/base/gtk/gtk_windowing.h" @@ -268,12 +268,12 @@ void AutocompletePopupViewGtk::SetupLayoutForMatch( AutocompletePopupViewGtk::AutocompletePopupViewGtk( const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, GtkWidget* location_bar) : model_(new AutocompletePopupModel(this, edit_model, profile)), - edit_view_(edit_view), + omnibox_view_(omnibox_view), location_bar_(location_bar), window_(gtk_window_new(GTK_WINDOW_POPUP)), layout_(NULL), @@ -458,9 +458,9 @@ void AutocompletePopupViewGtk::Hide() { } void AutocompletePopupViewGtk::StackWindow() { - gfx::NativeView edit_view = edit_view_->GetNativeView(); - DCHECK(GTK_IS_WIDGET(edit_view)); - GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view); + gfx::NativeView omnibox_view = omnibox_view_->GetNativeView(); + DCHECK(GTK_IS_WIDGET(omnibox_view)); + GtkWidget* toplevel = gtk_widget_get_toplevel(omnibox_view); DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); ui::StackPopupWindow(window_, toplevel); } @@ -479,7 +479,7 @@ void AutocompletePopupViewGtk::AcceptLine(size_t line, const GURL url(match.destination_url); string16 keyword; const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); - edit_view_->OpenURL(url, disposition, match.transition, GURL(), line, + omnibox_view_->OpenURL(url, disposition, match.transition, GURL(), line, is_keyword_hint ? string16() : keyword); } diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h index b3d442c..ea222e7 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h @@ -20,9 +20,9 @@ #include "webkit/glue/window_open_disposition.h" class AutocompleteEditModel; -class AutocompleteEditView; class AutocompletePopupModel; class GtkThemeService; +class OmniboxView; class Profile; class SkBitmap; @@ -30,7 +30,7 @@ class AutocompletePopupViewGtk : public AutocompletePopupView, public NotificationObserver { public: AutocompletePopupViewGtk(const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, GtkWidget* location_bar); @@ -106,7 +106,7 @@ class AutocompletePopupViewGtk : public AutocompletePopupView, gboolean HandleButtonRelease(GtkWidget* widget, GdkEventButton* event); scoped_ptr<AutocompletePopupModel> model_; - AutocompleteEditView* edit_view_; + OmniboxView* omnibox_view_; GtkWidget* location_bar_; // Our popup window, which is the only widget used, and we paint it on our diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.cc b/chrome/browser/automation/automation_autocomplete_edit_tracker.cc index 05a1ff7..68c8ec8 100644 --- a/chrome/browser/automation/automation_autocomplete_edit_tracker.cc +++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.cc @@ -9,20 +9,18 @@ AutomationAutocompleteEditTracker::AutomationAutocompleteEditTracker( IPC::Message::Sender* automation) - : AutomationResourceTracker<AutocompleteEditView*>(automation) { + : AutomationResourceTracker<OmniboxView*>(automation) { } AutomationAutocompleteEditTracker::~AutomationAutocompleteEditTracker() { } -void AutomationAutocompleteEditTracker::AddObserver( - AutocompleteEditView* resource) { +void AutomationAutocompleteEditTracker::AddObserver(OmniboxView* resource) { registrar_.Add(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, - Source<AutocompleteEditView>(resource)); + Source<OmniboxView>(resource)); } -void AutomationAutocompleteEditTracker::RemoveObserver( - AutocompleteEditView* resource) { +void AutomationAutocompleteEditTracker::RemoveObserver(OmniboxView* resource) { registrar_.Remove(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, - Source<AutocompleteEditView>(resource)); + Source<OmniboxView>(resource)); } diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.h b/chrome/browser/automation/automation_autocomplete_edit_tracker.h index 0e0a4ed..62bc6cd 100644 --- a/chrome/browser/automation/automation_autocomplete_edit_tracker.h +++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,16 +6,16 @@ #define CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_ #pragma once -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/automation/automation_resource_tracker.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" class AutomationAutocompleteEditTracker - : public AutomationResourceTracker<AutocompleteEditView*> { + : public AutomationResourceTracker<OmniboxView*> { public: explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation); virtual ~AutomationAutocompleteEditTracker(); - virtual void AddObserver(AutocompleteEditView* resource); - virtual void RemoveObserver(AutocompleteEditView* resource); + virtual void AddObserver(OmniboxView* resource); + virtual void RemoveObserver(OmniboxView* resource); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_ diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index a8523ea..84d2947 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1255,9 +1255,9 @@ void TestingAutomationProvider::GetAutocompleteEditForBrowser( if (browser_tracker_->ContainsHandle(browser_handle)) { Browser* browser = browser_tracker_->GetResource(browser_handle); LocationBar* loc_bar = browser->window()->GetLocationBar(); - AutocompleteEditView* edit_view = loc_bar->location_entry(); + OmniboxView* omnibox_view = loc_bar->location_entry(); // Add() returns the existing handle for the resource if any. - *autocomplete_edit_handle = autocomplete_edit_tracker_->Add(edit_view); + *autocomplete_edit_handle = autocomplete_edit_tracker_->Add(omnibox_view); *success = true; } } @@ -3124,8 +3124,8 @@ void TestingAutomationProvider::GetOmniboxInfo(Browser* browser, scoped_ptr<DictionaryValue> return_value(new DictionaryValue); LocationBar* loc_bar = browser->window()->GetLocationBar(); - AutocompleteEditView* edit_view = loc_bar->location_entry(); - AutocompleteEditModel* model = edit_view->model(); + OmniboxView* omnibox_view = loc_bar->location_entry(); + AutocompleteEditModel* model = omnibox_view->model(); // Fill up matches. ListValue* matches = new ListValue; @@ -3149,7 +3149,7 @@ void TestingAutomationProvider::GetOmniboxInfo(Browser* browser, properties->SetBoolean("query_in_progress", !model->autocomplete_controller()->done()); properties->SetString("keyword", model->keyword()); - properties->SetString("text", edit_view->GetText()); + properties->SetString("text", omnibox_view->GetText()); return_value->Set("properties", properties); AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); @@ -3168,9 +3168,9 @@ void TestingAutomationProvider::SetOmniboxText(Browser* browser, } browser->FocusLocationBar(); LocationBar* loc_bar = browser->window()->GetLocationBar(); - AutocompleteEditView* edit_view = loc_bar->location_entry(); - edit_view->model()->OnSetFocus(false); - edit_view->SetUserText(text); + OmniboxView* omnibox_view = loc_bar->location_entry(); + omnibox_view->model()->OnSetFocus(false); + omnibox_view->SetUserText(text); reply.SendSuccess(NULL); } diff --git a/chrome/browser/extensions/extension_omnibox_apitest.cc b/chrome/browser/extensions/extension_omnibox_apitest.cc index 9fd028f..38bac82 100644 --- a/chrome/browser/extensions/extension_omnibox_apitest.cc +++ b/chrome/browser/extensions/extension_omnibox_apitest.cc @@ -8,7 +8,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/extensions/extension_apitest.h" @@ -18,6 +17,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_type.h" diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 6e39bf7..705ef5d 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -6,7 +6,6 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/instant/instant_loader.h" @@ -18,6 +17,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/url_constants.h" #include "chrome/test/in_process_browser_test.h" diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 27c2ea6..9053dd8 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -11,7 +11,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -21,6 +20,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" @@ -208,14 +208,14 @@ void OmniboxSearchHint::ShowInfoBar() { void OmniboxSearchHint::ShowEnteringQuery() { LocationBar* location_bar = BrowserList::GetLastActive()->window()-> GetLocationBar(); - AutocompleteEditView* edit_view = location_bar->location_entry(); + OmniboxView* omnibox_view = location_bar->location_entry(); location_bar->FocusLocation(true); - edit_view->SetUserText( + omnibox_view->SetUserText( l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_OMNIBOX_TEXT)); - edit_view->SelectAll(false); - // Entering text in the autocomplete edit view triggers the suggestion popup - // that we don't want to show in this case. - edit_view->ClosePopup(); + omnibox_view->SelectAll(false); + // Entering text in the omnibox view triggers the suggestion popup that we + // don't want to show in this case. + omnibox_view->ClosePopup(); } void OmniboxSearchHint::DisableHint() { diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index cc69537..46e9aa1 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h @@ -68,8 +68,8 @@ class LocationBarViewMac : public AutocompleteEditController, virtual void InvalidatePageActions(); virtual void SaveStateToContents(TabContents* contents); virtual void Revert(); - virtual const AutocompleteEditView* location_entry() const; - virtual AutocompleteEditView* location_entry(); + virtual const OmniboxView* location_entry() const; + virtual OmniboxView* location_entry(); virtual LocationBarTesting* GetLocationBarForTesting(); // Overridden from LocationBarTesting: diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 238aea6..fb62c86 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -210,7 +210,7 @@ void LocationBarViewMac::Update(const TabContents* contents, star_decoration_->SetVisible(star_enabled); RefreshPageActionDecorations(); RefreshContentSettingsDecorations(); - // AutocompleteEditView restores state if the tab is non-NULL. + // OmniboxView restores state if the tab is non-NULL. omnibox_view_->Update(should_restore_state ? contents : NULL); OnChanged(); } @@ -298,11 +298,11 @@ void LocationBarViewMac::Revert() { omnibox_view_->RevertAll(); } -const AutocompleteEditView* LocationBarViewMac::location_entry() const { +const OmniboxView* LocationBarViewMac::location_entry() const { return omnibox_view_.get(); } -AutocompleteEditView* LocationBarViewMac::location_entry() { +OmniboxView* LocationBarViewMac::location_entry() { return omnibox_view_.get(); } diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h index 53c4a68..6b51ee5 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h @@ -10,8 +10,8 @@ #include "base/memory/scoped_ptr.h" #include "base/string16.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" class AutocompleteEditController; class AutocompletePopupViewMac; @@ -22,9 +22,9 @@ namespace ui { class Clipboard; } -// Implements AutocompleteEditView on an AutocompleteTextField. +// Implements OmniboxView on an AutocompleteTextField. -class OmniboxViewMac : public AutocompleteEditView, +class OmniboxViewMac : public OmniboxView, public AutocompleteTextFieldObserver { public: OmniboxViewMac(AutocompleteEditController* controller, @@ -34,7 +34,7 @@ class OmniboxViewMac : public AutocompleteEditView, AutocompleteTextField* field); virtual ~OmniboxViewMac(); - // Implement the AutocompleteEditView interface. + // OmniboxView: virtual AutocompleteEditModel* model(); virtual const AutocompleteEditModel* model() const; diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 8c89430..5f721ff 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -13,7 +13,6 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/prefs/pref_service.h" @@ -40,6 +39,7 @@ #import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/browser/ui/toolbar/wrench_menu_model.h" #include "chrome/browser/upgrade_detector.h" diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 71a44df..6126b86 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -23,7 +23,6 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" @@ -71,6 +70,7 @@ #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h" #include "chrome/browser/ui/gtk/update_recommended_dialog.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/bug_report_ui.h" #include "chrome/browser/ui/window_sizer.h" diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 65cafac..6941fa1 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -699,11 +699,11 @@ void LocationBarViewGtk::Revert() { location_entry_->RevertAll(); } -const AutocompleteEditView* LocationBarViewGtk::location_entry() const { +const OmniboxView* LocationBarViewGtk::location_entry() const { return location_entry_.get(); } -AutocompleteEditView* LocationBarViewGtk::location_entry() { +OmniboxView* LocationBarViewGtk::location_entry() { return location_entry_.get(); } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index ec20f2d..f9aee14 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -123,8 +123,8 @@ class LocationBarViewGtk : public AutocompleteEditController, virtual void InvalidatePageActions(); virtual void SaveStateToContents(TabContents* contents); virtual void Revert(); - virtual const AutocompleteEditView* location_entry() const; - virtual AutocompleteEditView* location_entry(); + virtual const OmniboxView* location_entry() const; + virtual OmniboxView* location_entry(); virtual LocationBarTesting* GetLocationBarForTesting(); // Implement the LocationBarTesting interface. diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index 89989f5..2d7f08c 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -877,13 +877,12 @@ int OmniboxViewGtk::OnPerformDrop( } // static -AutocompleteEditView* OmniboxViewGtk::Create( - AutocompleteEditController* controller, - ToolbarModel* toolbar_model, - Profile* profile, - CommandUpdater* command_updater, - bool popup_window_mode, - views::View* location_bar) { +OmniboxView* OmniboxViewGtk::Create(AutocompleteEditController* controller, + ToolbarModel* toolbar_model, + Profile* profile, + CommandUpdater* command_updater, + bool popup_window_mode, + views::View* location_bar) { if (views::NativeTextfieldViews::IsTextfieldViewsEnabled()) { OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, toolbar_model, diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h index 345e199..740fafd 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h @@ -14,8 +14,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/string_util.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/ui/gtk/owned_widget_gtk.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" @@ -48,7 +48,7 @@ class View; class GtkThemeService; #endif -class OmniboxViewGtk : public AutocompleteEditView, +class OmniboxViewGtk : public OmniboxView, public NotificationObserver, public ui::AnimationDelegate { public: @@ -88,7 +88,7 @@ class OmniboxViewGtk : public AutocompleteEditView, // LocationBarView::Layout as to why this uses -1. int WidthOfTextAfterCursor(); - // Implement the AutocompleteEditView interface. + // OmniboxView: virtual AutocompleteEditModel* model(); virtual const AutocompleteEditModel* model() const; @@ -149,16 +149,16 @@ class OmniboxViewGtk : public AutocompleteEditView, virtual views::View* AddToView(views::View* parent); virtual int OnPerformDrop(const views::DropTargetEvent& event); - // A factory method to create an AutocompleteEditView instance initialized for + // A factory method to create an OmniboxView instance initialized for // linux_views. This currently returns an instance of OmniboxViewGtk only, // but OmniboxViewViews will be added as an option when TextfieldViews is // enabled. - static AutocompleteEditView* Create(AutocompleteEditController* controller, - ToolbarModel* toolbar_model, - Profile* profile, - CommandUpdater* command_updater, - bool popup_window_mode, - views::View* location_bar); + static OmniboxView* Create(AutocompleteEditController* controller, + ToolbarModel* toolbar_model, + Profile* profile, + CommandUpdater* command_updater, + bool popup_window_mode, + views::View* location_bar); #endif // Overridden from NotificationObserver: diff --git a/chrome/browser/ui/omnibox/location_bar.h b/chrome/browser/ui/omnibox/location_bar.h index d0916b1..184d38f 100644 --- a/chrome/browser/ui/omnibox/location_bar.h +++ b/chrome/browser/ui/omnibox/location_bar.h @@ -20,10 +20,10 @@ #include "content/common/page_transition_types.h" #include "webkit/glue/window_open_disposition.h" -class AutocompleteEditView; class ExtensionAction; class InstantController; class LocationBarTesting; +class OmniboxView; class TabContents; class TabContentsWrapper; @@ -76,8 +76,8 @@ class LocationBar { virtual void Revert() = 0; // Returns a pointer to the text entry view. - virtual const AutocompleteEditView* location_entry() const = 0; - virtual AutocompleteEditView* location_entry() = 0; + virtual const OmniboxView* location_entry() const = 0; + virtual OmniboxView* location_entry() = 0; // Returns a pointer to the testing interface. virtual LocationBarTesting* GetLocationBarForTesting() = 0; diff --git a/chrome/browser/autocomplete/autocomplete_edit_view.h b/chrome/browser/ui/omnibox/omnibox_view.h index 2054699..3f06c92 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view.h +++ b/chrome/browser/ui/omnibox/omnibox_view.h @@ -1,15 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. -// This file defines the interface class AutocompleteEditView. Each toolkit -// will implement the edit view differently, so that code is inherently -// platform specific. However, the AutocompleteEditModel needs to do some -// communication with the view. Since the model is shared between platforms, -// we need to define an interface that all view implementations will share. +// This file defines the interface class OmniboxView. Each toolkit will +// implement the edit view differently, so that code is inherently platform +// specific. However, the AutocompleteEditModel needs to do some communication +// with the view. Since the model is shared between platforms, we need to +// define an interface that all view implementations will share. -#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ -#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ +#ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ +#define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ #pragma once #include <string> @@ -31,7 +31,7 @@ class View; } // namespace views #endif -class AutocompleteEditView { +class OmniboxView { public: // Used by the automation system for getting at the model from the view. virtual AutocompleteEditModel* model() = 0; @@ -183,7 +183,7 @@ class AutocompleteEditView { virtual int OnPerformDrop(const views::DropTargetEvent& event) = 0; #endif - virtual ~AutocompleteEditView() {} + virtual ~OmniboxView() {} }; -#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ +#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index e1c1251..8936873 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -12,7 +12,6 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -23,6 +22,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/in_process_browser_test.h" @@ -140,10 +140,10 @@ const int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN; } // namespace -class AutocompleteEditViewTest : public InProcessBrowserTest, +class OmniboxViewTest : public InProcessBrowserTest, public NotificationObserver { protected: - AutocompleteEditViewTest() { + OmniboxViewTest() { set_show_window(true); } @@ -159,19 +159,19 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, VIEW_ID_LOCATION_BAR)); } - static void GetAutocompleteEditViewForBrowser( + static void GetOmniboxViewForBrowser( const Browser* browser, - AutocompleteEditView** edit_view) { + OmniboxView** omnibox_view) { BrowserWindow* window = browser->window(); ASSERT_TRUE(window); LocationBar* loc_bar = window->GetLocationBar(); ASSERT_TRUE(loc_bar); - *edit_view = loc_bar->location_entry(); - ASSERT_TRUE(*edit_view); + *omnibox_view = loc_bar->location_entry(); + ASSERT_TRUE(*omnibox_view); } - void GetAutocompleteEditView(AutocompleteEditView** edit_view) { - GetAutocompleteEditViewForBrowser(browser(), edit_view); + void GetOmniboxView(OmniboxView** omnibox_view) { + GetOmniboxViewForBrowser(browser(), omnibox_view); } static void SendKeyForBrowser(const Browser* browser, @@ -232,11 +232,11 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void WaitForAutocompleteControllerDone() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); AutocompleteController* controller = - edit_view->model()->popup_model()->autocomplete_controller(); + omnibox_view->model()->popup_model()->autocomplete_controller(); ASSERT_TRUE(controller); if (controller->done()) @@ -358,8 +358,8 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void BrowserAcceleratorsTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); int tab_count = browser()->tab_count(); @@ -384,16 +384,16 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count)); // Try ctrl-l to focus location bar. - edit_view->SetUserText(ASCIIToUTF16("Hello world")); - EXPECT_FALSE(edit_view->IsSelectAll()); + omnibox_view->SetUserText(ASCIIToUTF16("Hello world")); + EXPECT_FALSE(omnibox_view->IsSelectAll()); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_L, kCtrlOrCmdMask)); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); // Try editing the location bar text. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, 0)); - EXPECT_FALSE(edit_view->IsSelectAll()); + EXPECT_FALSE(omnibox_view->IsSelectAll()); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_S, 0)); - EXPECT_EQ(ASCIIToUTF16("Hello worlds"), edit_view->GetText()); + EXPECT_EQ(ASCIIToUTF16("Hello worlds"), omnibox_view->GetText()); // Try ctrl-x to cut text. #if defined(OS_MACOSX) @@ -404,9 +404,9 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE( SendKey(ui::VKEY_LEFT, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN)); #endif - EXPECT_FALSE(edit_view->IsSelectAll()); + EXPECT_FALSE(omnibox_view->IsSelectAll()); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_X, kCtrlOrCmdMask)); - EXPECT_EQ(ASCIIToUTF16("Hello "), edit_view->GetText()); + EXPECT_EQ(ASCIIToUTF16("Hello "), omnibox_view->GetText()); #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) // Try alt-f4 to close the browser. @@ -420,11 +420,11 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // Create a popup. Browser* popup = CreateBrowserForPopup(browser()->profile()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(popup)); - AutocompleteEditView* edit_view = NULL; + OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE( - GetAutocompleteEditViewForBrowser(popup, &edit_view)); + GetOmniboxViewForBrowser(popup, &omnibox_view)); popup->FocusLocationBar(); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); #if !defined(OS_MACOSX) // Try ctrl-w to close the popup. @@ -439,23 +439,23 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, popup = CreateBrowserForPopup(browser()->profile()); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(popup)); ASSERT_NO_FATAL_FAILURE( - GetAutocompleteEditViewForBrowser(popup, &edit_view)); + GetOmniboxViewForBrowser(popup, &omnibox_view)); #endif // Set the edit text to "Hello world". - edit_view->SetUserText(ASCIIToUTF16("Hello world")); + omnibox_view->SetUserText(ASCIIToUTF16("Hello world")); popup->FocusLocationBar(); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); // Try editing the location bar text -- should be disallowed. ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, ui::VKEY_S, 0)); - EXPECT_EQ(ASCIIToUTF16("Hello world"), edit_view->GetText()); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_EQ(ASCIIToUTF16("Hello world"), omnibox_view->GetText()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); ASSERT_NO_FATAL_FAILURE( SendKeyForBrowser(popup, ui::VKEY_X, kCtrlOrCmdMask)); - EXPECT_EQ(ASCIIToUTF16("Hello world"), edit_view->GetText()); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_EQ(ASCIIToUTF16("Hello world"), omnibox_view->GetText()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) // Try alt-f4 to close the popup. @@ -466,28 +466,28 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void BackspaceInKeywordModeTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); // Trigger keyword hint mode. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Trigger keyword mode. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Backspace without search text should bring back keyword hint mode. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Trigger keyword mode again. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Input something as search text. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); @@ -496,8 +496,8 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // backspace. for (size_t i = 0; i < arraysize(kSearchText) - 1; ++i) { ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); } // Input something as search text. @@ -513,37 +513,37 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // Backspace at the beginning of the search text shall turn off // the keyword mode. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(string16(), edit_view->model()->keyword()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(string16(), omnibox_view->model()->keyword()); ASSERT_EQ(std::string(kSearchKeyword) + kSearchText, - UTF16ToUTF8(edit_view->GetText())); + UTF16ToUTF8(omnibox_view->GetText())); } void EscapeTest() { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); browser()->FocusLocationBar(); - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); EXPECT_FALSE(old_text.empty()); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); // Delete all text in omnibox. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); // Escape shall revert the text in omnibox. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); - EXPECT_EQ(old_text, edit_view->GetText()); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_EQ(old_text, omnibox_view->GetText()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); } void DesiredTLDTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Test ctrl-Enter. @@ -559,10 +559,10 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void AltEnterTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - edit_view->SetUserText(ASCIIToUTF16(chrome::kChromeUIHistoryURL)); + omnibox_view->SetUserText(ASCIIToUTF16(chrome::kChromeUIHistoryURL)); int tab_count = browser()->tab_count(); // alt-Enter opens a new tab. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, ui::EF_ALT_DOWN)); @@ -570,9 +570,9 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void EnterToSearchTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Test Enter to search. @@ -591,11 +591,11 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // Test that entering a single character then Enter performs a search. browser()->FocusLocationBar(); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchSingleCharKeys)); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); - EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(edit_view->GetText())); + EXPECT_EQ(kSearchSingleChar, UTF16ToUTF8(omnibox_view->GetText())); // Check if the default match result is Search Primary Provider. ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED, @@ -608,9 +608,9 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void EscapeToDefaultMatchTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Input something to trigger inline autocomplete. @@ -618,7 +618,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); // Make sure inline autocomplete is triggerred. EXPECT_GT(old_text.length(), arraysize(kInlineAutocompleteText) - 1); @@ -631,15 +631,15 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, while (popup_model->selected_line() < size - 1) { ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, 0)); ASSERT_NE(old_selected_line, popup_model->selected_line()); - if (old_text != edit_view->GetText()) + if (old_text != omnibox_view->GetText()) break; } - EXPECT_NE(old_text, edit_view->GetText()); + EXPECT_NE(old_text, omnibox_view->GetText()); // Escape shall revert back to the default match item. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, 0)); - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); EXPECT_EQ(old_selected_line, popup_model->selected_line()); } @@ -647,15 +647,15 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); browser()->FocusLocationBar(); - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), old_text); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); string16::size_type start, end; - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); EXPECT_EQ(old_text.size(), end); @@ -666,115 +666,116 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, #else ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); #endif - EXPECT_FALSE(edit_view->IsSelectAll()); + EXPECT_FALSE(omnibox_view->IsSelectAll()); // Make sure the cursor is placed correctly. - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(old_text.size(), start); EXPECT_EQ(old_text.size(), end); // Insert one character at the end. Make sure we won't insert // anything after the special ZWS mark used in gtk implementation. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); - EXPECT_EQ(old_text + char16('a'), edit_view->GetText()); + EXPECT_EQ(old_text + char16('a'), omnibox_view->GetText()); // Delete one character from the end. Make sure we won't delete the special // ZWS mark used in gtk implementation. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); - edit_view->SelectAll(true); - EXPECT_TRUE(edit_view->IsSelectAll()); - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->SelectAll(true); + EXPECT_TRUE(omnibox_view->IsSelectAll()); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); EXPECT_EQ(old_text.size(), end); // Delete the content ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, 0)); - EXPECT_TRUE(edit_view->IsSelectAll()); - edit_view->GetSelectionBounds(&start, &end); + EXPECT_TRUE(omnibox_view->IsSelectAll()); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); EXPECT_EQ(0U, end); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); // Check if RevertAll() can set text and cursor correctly. - edit_view->RevertAll(); - EXPECT_FALSE(edit_view->IsSelectAll()); - EXPECT_EQ(old_text, edit_view->GetText()); - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->RevertAll(); + EXPECT_FALSE(omnibox_view->IsSelectAll()); + EXPECT_EQ(old_text, omnibox_view->GetText()); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(old_text.size(), start); EXPECT_EQ(old_text.size(), end); } void AcceptKeywordBySpaceTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); string16 text = UTF8ToUTF16(kSearchKeyword); // Trigger keyword hint mode. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text, edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text, omnibox_view->GetText()); // Trigger keyword mode by space. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_TRUE(edit_view->GetText().empty()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_TRUE(omnibox_view->GetText().empty()); // Revert to keyword hint mode. - edit_view->model()->ClearKeyword(string16()); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text, edit_view->GetText()); + omnibox_view->model()->ClearKeyword(string16()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text, omnibox_view->GetText()); // Keyword should also be accepted by typing an ideographic space. - edit_view->OnBeforePossibleChange(); - edit_view->SetWindowTextAndCaretPos(text + WideToUTF16(L"\x3000"), + omnibox_view->OnBeforePossibleChange(); + omnibox_view->SetWindowTextAndCaretPos(text + WideToUTF16(L"\x3000"), text.length() + 1); - edit_view->OnAfterPossibleChange(); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_TRUE(edit_view->GetText().empty()); + omnibox_view->OnAfterPossibleChange(); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_TRUE(omnibox_view->GetText().empty()); // Revert to keyword hint mode. - edit_view->model()->ClearKeyword(string16()); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text, edit_view->GetText()); + omnibox_view->model()->ClearKeyword(string16()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text, omnibox_view->GetText()); // Keyword shouldn't be accepted by pasting. // Simulate pasting a whitespace to the end of content. - edit_view->OnBeforePossibleChange(); - edit_view->model()->on_paste(); - edit_view->SetWindowTextAndCaretPos(text + char16(' '), text.length() + 1); - edit_view->OnAfterPossibleChange(); + omnibox_view->OnBeforePossibleChange(); + omnibox_view->model()->on_paste(); + omnibox_view->SetWindowTextAndCaretPos( + text + char16(' '), text.length() + 1); + omnibox_view->OnAfterPossibleChange(); // Should be still in keyword hint mode. - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text + char16(' '), edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text + char16(' '), omnibox_view->GetText()); // Keyword shouldn't be accepted by pressing space with a trailing // whitespace. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text + ASCIIToUTF16(" "), edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text + ASCIIToUTF16(" "), omnibox_view->GetText()); // Keyword shouldn't be accepted by deleting the trailing space. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text + char16(' '), edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text + char16(' '), omnibox_view->GetText()); // Keyword shouldn't be accepted by pressing space before a trailing space. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text + ASCIIToUTF16(" "), edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text + ASCIIToUTF16(" "), omnibox_view->GetText()); // Keyword should be accepted by pressing space in the middle of context and // just after the keyword. @@ -782,51 +783,51 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(ASCIIToUTF16("a "), edit_view->GetText()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(ASCIIToUTF16("a "), omnibox_view->GetText()); // Keyword shouldn't be accepted by pasting "foo bar". - edit_view->SetUserText(string16()); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_TRUE(edit_view->model()->keyword().empty()); + omnibox_view->SetUserText(string16()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_TRUE(omnibox_view->model()->keyword().empty()); - edit_view->OnBeforePossibleChange(); - edit_view->model()->on_paste(); - edit_view->SetWindowTextAndCaretPos(text + ASCIIToUTF16(" bar"), + omnibox_view->OnBeforePossibleChange(); + omnibox_view->model()->on_paste(); + omnibox_view->SetWindowTextAndCaretPos(text + ASCIIToUTF16(" bar"), text.length() + 4); - edit_view->OnAfterPossibleChange(); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_TRUE(edit_view->model()->keyword().empty()); - ASSERT_EQ(text + ASCIIToUTF16(" bar"), edit_view->GetText()); + omnibox_view->OnAfterPossibleChange(); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_TRUE(omnibox_view->model()->keyword().empty()); + ASSERT_EQ(text + ASCIIToUTF16(" bar"), omnibox_view->GetText()); // Keyword shouldn't be accepted for case like: "foo b|ar" -> "foo b |ar". ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_TRUE(edit_view->model()->keyword().empty()); - ASSERT_EQ(text + ASCIIToUTF16(" b ar"), edit_view->GetText()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_TRUE(omnibox_view->model()->keyword().empty()); + ASSERT_EQ(text + ASCIIToUTF16(" b ar"), omnibox_view->GetText()); // Keyword could be accepted by pressing space with a selected range at the // end of text. - edit_view->OnBeforePossibleChange(); - edit_view->OnInlineAutocompleteTextMaybeChanged( + omnibox_view->OnBeforePossibleChange(); + omnibox_view->OnInlineAutocompleteTextMaybeChanged( text + ASCIIToUTF16(" "), text.length()); - edit_view->OnAfterPossibleChange(); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(text + ASCIIToUTF16(" "), edit_view->GetText()); + omnibox_view->OnAfterPossibleChange(); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(text + ASCIIToUTF16(" "), omnibox_view->GetText()); string16::size_type start, end; - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->GetSelectionBounds(&start, &end); ASSERT_NE(start, end); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_EQ(string16(), edit_view->GetText()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_EQ(string16(), omnibox_view->GetText()); - edit_view->SetUserText(string16()); + omnibox_view->SetUserText(string16()); // Space should accept keyword even when inline autocomplete is available. const TestHistoryEntry kHistoryFoobar = { @@ -840,24 +841,24 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // Type "foo" to trigger inline autocomplete. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); - ASSERT_TRUE(edit_view->model()->popup_model()->IsOpen()); - ASSERT_NE(text, edit_view->GetText()); + ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen()); + ASSERT_NE(text, omnibox_view->GetText()); // Keyword hint shouldn't be visible. - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_TRUE(edit_view->model()->keyword().empty()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_TRUE(omnibox_view->model()->keyword().empty()); // Trigger keyword mode by space. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(text, edit_view->model()->keyword()); - ASSERT_TRUE(edit_view->GetText().empty()); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(text, omnibox_view->model()->keyword()); + ASSERT_TRUE(omnibox_view->GetText().empty()); } void NonSubstitutingKeywordTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); TemplateURLModel* template_url_model = @@ -870,7 +871,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, template_url->set_short_name(UTF8ToUTF16("Search abc")); template_url_model->Add(template_url); - edit_view->SetUserText(string16()); + omnibox_view->SetUserText(string16()); // Non-default substituting keyword shouldn't be matched by default. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); @@ -883,7 +884,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_EQ(kSearchTextURL, popup_model->result().default_match()->destination_url.spec()); - edit_view->SetUserText(string16()); + omnibox_view->SetUserText(string16()); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_FALSE(popup_model->IsOpen()); @@ -914,16 +915,16 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); browser()->FocusLocationBar(); - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); // Input something that can match history items. - edit_view->SetUserText(ASCIIToUTF16("bar")); + omnibox_view->SetUserText(ASCIIToUTF16("bar")); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); @@ -933,10 +934,10 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_TRUE(popup_model->IsOpen()); ASSERT_GE(popup_model->result().size(), 3U); - string16 user_text = edit_view->GetText(); + string16 user_text = omnibox_view->GetText(); ASSERT_EQ(ASCIIToUTF16("bar"), user_text); - edit_view->SelectAll(true); - ASSERT_TRUE(edit_view->IsSelectAll()); + omnibox_view->SelectAll(true); + ASSERT_TRUE(omnibox_view->IsSelectAll()); // The first item should be the default match. size_t default_line = popup_model->selected_line(); @@ -944,13 +945,13 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, popup_model->result().match_at(default_line).destination_url.spec(); // Move down. - edit_view->model()->OnUpOrDownKeyPressed(1); + omnibox_view->model()->OnUpOrDownKeyPressed(1); ASSERT_EQ(default_line + 1, popup_model->selected_line()); string16 selected_text = popup_model->result().match_at(default_line + 1).fill_into_edit; // Temporary text is shown. - ASSERT_EQ(selected_text, edit_view->GetText()); - ASSERT_FALSE(edit_view->IsSelectAll()); + ASSERT_EQ(selected_text, omnibox_view->GetText()); + ASSERT_FALSE(omnibox_view->IsSelectAll()); // Delete the item. popup_model->TryDeletingCurrentItem(); @@ -964,24 +965,24 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, selected_text = popup_model->result().match_at(default_line + 1).fill_into_edit; // New temporary text is shown. - ASSERT_EQ(selected_text, edit_view->GetText()); + ASSERT_EQ(selected_text, omnibox_view->GetText()); // Revert to the default match. - ASSERT_TRUE(edit_view->model()->OnEscapeKeyPressed()); + ASSERT_TRUE(omnibox_view->model()->OnEscapeKeyPressed()); ASSERT_EQ(default_line, popup_model->selected_line()); - ASSERT_EQ(user_text, edit_view->GetText()); - ASSERT_TRUE(edit_view->IsSelectAll()); + ASSERT_EQ(user_text, omnibox_view->GetText()); + ASSERT_TRUE(omnibox_view->IsSelectAll()); // Move down and up to select the default match as temporary text. - edit_view->model()->OnUpOrDownKeyPressed(1); + omnibox_view->model()->OnUpOrDownKeyPressed(1); ASSERT_EQ(default_line + 1, popup_model->selected_line()); - edit_view->model()->OnUpOrDownKeyPressed(-1); + omnibox_view->model()->OnUpOrDownKeyPressed(-1); ASSERT_EQ(default_line, popup_model->selected_line()); selected_text = popup_model->result().match_at(default_line).fill_into_edit; // New temporary text is shown. - ASSERT_EQ(selected_text, edit_view->GetText()); - ASSERT_FALSE(edit_view->IsSelectAll()); + ASSERT_EQ(selected_text, omnibox_view->GetText()); + ASSERT_FALSE(omnibox_view->IsSelectAll()); // Delete the default item. popup_model->TryDeletingCurrentItem(); @@ -995,20 +996,20 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, selected_text = popup_model->result().match_at(default_line).fill_into_edit; // New temporary text is shown. - ASSERT_EQ(selected_text, edit_view->GetText()); + ASSERT_EQ(selected_text, omnibox_view->GetText()); // As the current selected item is the new default item, pressing Escape key // should revert all directly. - ASSERT_TRUE(edit_view->model()->OnEscapeKeyPressed()); - ASSERT_EQ(old_text, edit_view->GetText()); - ASSERT_TRUE(edit_view->IsSelectAll()); + ASSERT_TRUE(omnibox_view->model()->OnEscapeKeyPressed()); + ASSERT_EQ(old_text, omnibox_view->GetText()); + ASSERT_TRUE(omnibox_view->IsSelectAll()); } void TabMoveCursorToEndTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - edit_view->SetUserText(ASCIIToUTF16("Hello world")); + omnibox_view->SetUserText(ASCIIToUTF16("Hello world")); // Move cursor to the beginning. #if defined(OS_MACOSX) @@ -1019,33 +1020,33 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, #endif string16::size_type start, end; - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); EXPECT_EQ(0U, end); // Pressing tab should move cursor to the end. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, 0)); - edit_view->GetSelectionBounds(&start, &end); - EXPECT_EQ(edit_view->GetText().size(), start); - EXPECT_EQ(edit_view->GetText().size(), end); + omnibox_view->GetSelectionBounds(&start, &end); + EXPECT_EQ(omnibox_view->GetText().size(), start); + EXPECT_EQ(omnibox_view->GetText().size(), end); // The location bar should still have focus. ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR)); // Select all text. - edit_view->SelectAll(true); - EXPECT_TRUE(edit_view->IsSelectAll()); - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->SelectAll(true); + EXPECT_TRUE(omnibox_view->IsSelectAll()); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); - EXPECT_EQ(edit_view->GetText().size(), end); + EXPECT_EQ(omnibox_view->GetText().size(), end); // Pressing tab should move cursor to the end. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, 0)); - edit_view->GetSelectionBounds(&start, &end); - EXPECT_EQ(edit_view->GetText().size(), start); - EXPECT_EQ(edit_view->GetText().size(), end); + omnibox_view->GetSelectionBounds(&start, &end); + EXPECT_EQ(omnibox_view->GetText().size(), start); + EXPECT_EQ(omnibox_view->GetText().size(), end); // The location bar should still have focus. ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR)); @@ -1057,18 +1058,18 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } void PersistKeywordModeOnTabSwitch() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); // Trigger keyword hint mode. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); - ASSERT_TRUE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_TRUE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Trigger keyword mode. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, 0)); - ASSERT_FALSE(edit_view->model()->is_keyword_hint()); - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); // Input something as search text. ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); @@ -1080,13 +1081,13 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, browser()->ActivateTabAt(0, true); // Make sure we're still in keyword mode. - ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); + ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword())); } void CtrlKeyPressedWithInlineAutocompleteTest() { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Input something to trigger inline autocomplete. @@ -1094,16 +1095,16 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); // Make sure inline autocomplete is triggerred. EXPECT_GT(old_text.length(), arraysize(kInlineAutocompleteText) - 1); // Press ctrl key. - edit_view->model()->OnControlKeyChanged(true); + omnibox_view->model()->OnControlKeyChanged(true); // Inline autocomplete should still be there. - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); } }; @@ -1112,7 +1113,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, // See http://crbug.com/19193: omnibox blocks ctrl-* commands // // Flaky on interactive tests (dbg), http://crbug.com/69433 -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, FLAKY_BrowserAccelerators) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, FLAKY_BrowserAccelerators) { BrowserAcceleratorsTest(); } @@ -1123,65 +1124,65 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, FLAKY_BrowserAccelerators) { #define MAYBE_PopupAccelerators PopupAccelerators #endif -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_PopupAccelerators) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_PopupAccelerators) { PopupAcceleratorsTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BackspaceInKeywordMode) { BackspaceInKeywordModeTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, Escape) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, Escape) { EscapeTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DesiredTLD) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DesiredTLD) { DesiredTLDTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, AltEnter) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AltEnter) { AltEnterTest(); } // DISABLED http://crbug.com/80118 #if defined(OS_LINUX) -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DISABLED_EnterToSearch) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DISABLED_EnterToSearch) { #else -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EnterToSearch) { #endif // OS_LINUX EnterToSearchTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, EscapeToDefaultMatch) { EscapeToDefaultMatchTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BasicTextOperations) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) { BasicTextOperationsTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, AcceptKeywordBySpace) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordBySpace) { AcceptKeywordBySpaceTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, NonSubstitutingKeywordTest) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, NonSubstitutingKeywordTest) { NonSubstitutingKeywordTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DeleteItem) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, DeleteItem) { DeleteItemTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, TabMoveCursorToEnd) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, TabMoveCursorToEnd) { TabMoveCursorToEndTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PersistKeywordModeOnTabSwitch) { PersistKeywordModeOnTabSwitch(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlKeyPressedWithInlineAutocompleteTest) { CtrlKeyPressedWithInlineAutocompleteTest(); } @@ -1190,118 +1191,118 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, // TODO(oshima): enable these tests for views-implmentation when // these featuers are supported. -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, UndoRedoLinux) { +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, UndoRedoLinux) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); browser()->FocusLocationBar(); - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - string16 old_text = edit_view->GetText(); + string16 old_text = omnibox_view->GetText(); EXPECT_EQ(UTF8ToUTF16(chrome::kAboutBlankURL), old_text); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); // Undo should clear the omnibox. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); // Nothing should happen if undo again. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); // Redo should restore the original text. ASSERT_NO_FATAL_FAILURE( SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN)); - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); // Looks like the undo manager doesn't support restoring selection. - EXPECT_FALSE(edit_view->IsSelectAll()); + EXPECT_FALSE(omnibox_view->IsSelectAll()); // The cursor should be at the end. string16::size_type start, end; - edit_view->GetSelectionBounds(&start, &end); + omnibox_view->GetSelectionBounds(&start, &end); EXPECT_EQ(old_text.size(), start); EXPECT_EQ(old_text.size(), end); // Delete two characters. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); + EXPECT_EQ(old_text.substr(0, old_text.size() - 2), omnibox_view->GetText()); // Undo delete. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); // Redo delete. ASSERT_NO_FATAL_FAILURE( SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN)); - EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); + EXPECT_EQ(old_text.substr(0, old_text.size() - 2), omnibox_view->GetText()); // Delete everything. - edit_view->SelectAll(true); + omnibox_view->SelectAll(true); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); // Undo delete everything. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); + EXPECT_EQ(old_text.substr(0, old_text.size() - 2), omnibox_view->GetText()); // Undo delete two characters. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_EQ(old_text, edit_view->GetText()); + EXPECT_EQ(old_text, omnibox_view->GetText()); // Undo again. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, ui::EF_CONTROL_DOWN)); - EXPECT_TRUE(edit_view->GetText().empty()); + EXPECT_TRUE(omnibox_view->GetText().empty()); } // See http://crbug.com/63860 -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PrimarySelection) { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - edit_view->SetUserText(ASCIIToUTF16("Hello world")); - EXPECT_FALSE(edit_view->IsSelectAll()); +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PrimarySelection) { + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + omnibox_view->SetUserText(ASCIIToUTF16("Hello world")); + EXPECT_FALSE(omnibox_view->IsSelectAll()); // Move the cursor to the end. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); // Select all text by pressing Shift+Home ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_HOME, ui::EF_SHIFT_DOWN)); - EXPECT_TRUE(edit_view->IsSelectAll()); + EXPECT_TRUE(omnibox_view->IsSelectAll()); // The selected content should be saved to the PRIMARY clipboard. EXPECT_EQ("Hello world", GetPrimarySelectionText()); // Move the cursor to the end. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); - EXPECT_FALSE(edit_view->IsSelectAll()); + EXPECT_FALSE(omnibox_view->IsSelectAll()); // The content in the PRIMARY clipboard should not be cleared. EXPECT_EQ("Hello world", GetPrimarySelectionText()); } // See http://crosbug.com/10306 -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BackspaceDeleteHalfWidthKatakana) { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); // Insert text: ダ - edit_view->SetUserText(UTF8ToUTF16("\357\276\200\357\276\236")); + omnibox_view->SetUserText(UTF8ToUTF16("\357\276\200\357\276\236")); // Move the cursor to the end. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, 0)); // Backspace should delete one character. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0)); - EXPECT_EQ(UTF8ToUTF16("\357\276\200"), edit_view->GetText()); + EXPECT_EQ(UTF8ToUTF16("\357\276\200"), omnibox_view->GetText()); } // http://crbug.com/12316 // Flaky, http://crbug.com/80934. -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, FLAKY_PasteReplacingAll) { - AutocompleteEditView* edit_view = NULL; - ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view)); - AutocompletePopupModel* popup_model = edit_view->model()->popup_model(); +IN_PROC_BROWSER_TEST_F(OmniboxViewTest, FLAKY_PasteReplacingAll) { + OmniboxView* omnibox_view = NULL; + ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); + AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); SetClipboardText(kSearchText); @@ -1312,81 +1313,81 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, FLAKY_PasteReplacingAll) { ASSERT_TRUE(popup_model->IsOpen()); // Inline autocomplete shouldn't be triggered. - ASSERT_EQ(ASCIIToUTF16("abc"), edit_view->GetText()); + ASSERT_EQ(ASCIIToUTF16("abc"), omnibox_view->GetText()); } #endif #if defined(TOOLKIT_VIEWS) -class AutocompleteEditViewViewsTest : public AutocompleteEditViewTest { +class OmniboxViewViewsTest : public OmniboxViewTest { public: - AutocompleteEditViewViewsTest() { + OmniboxViewViewsTest() { views::NativeTextfieldViews::SetEnableTextfieldViews(true); } }; -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, FLAKY_BrowserAccelerators) { BrowserAcceleratorsTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, MAYBE_PopupAccelerators) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, MAYBE_PopupAccelerators) { PopupAcceleratorsTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, BackspaceInKeywordMode) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BackspaceInKeywordMode) { BackspaceInKeywordModeTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, Escape) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, Escape) { EscapeTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, DesiredTLD) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DesiredTLD) { DesiredTLDTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, AltEnter) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, AltEnter) { AltEnterTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, EnterToSearch) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, EnterToSearch) { EnterToSearchTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, EscapeToDefaultMatch) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, EscapeToDefaultMatch) { EscapeToDefaultMatchTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, BasicTextOperations) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, BasicTextOperations) { BasicTextOperationsTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, AcceptKeywordBySpace) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, AcceptKeywordBySpace) { AcceptKeywordBySpaceTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, NonSubstitutingKeywordTest) { NonSubstitutingKeywordTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, DeleteItem) { +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DeleteItem) { DeleteItemTest(); } // TODO(suzhe): This test is broken because of broken ViewID support when // enabling OmniboxViewViews. -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, DISABLED_TabMoveCursorToEnd) { TabMoveCursorToEndTest(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, PersistKeywordModeOnTabSwitch) { PersistKeywordModeOnTabSwitch(); } -IN_PROC_BROWSER_TEST_F(AutocompleteEditViewViewsTest, +IN_PROC_BROWSER_TEST_F(OmniboxViewViewsTest, CtrlKeyPressedWithInlineAutocompleteTest) { CtrlKeyPressedWithInlineAutocompleteTest(); } diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model.h index d9ebec5..140b2f9 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.h +++ b/chrome/browser/ui/toolbar/toolbar_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -42,7 +42,7 @@ class ToolbarModel { // Returns the resource_id of the icon to show to the left of the address, // based on the current URL. This doesn't cover specialized icons while the - // user is editing; see AutocompleteEditView::GetIcon(). + // user is editing; see OmniboxView::GetIcon(). int GetIcon() const; // Returns the name of the EV cert holder. Only call this when the security diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 5065c40..23d9a0e 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -6,11 +6,11 @@ #include "base/compiler_specific.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/instant/instant_confirm_dialog.h" #include "chrome/browser/instant/promo_counter.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h" #include "chrome/browser/ui/views/bubble/bubble_border.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" @@ -202,13 +202,13 @@ class AutocompletePopupContentsView::InstantOptInView AutocompletePopupContentsView::AutocompletePopupContentsView( const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, const views::View* location_bar) : model_(new AutocompletePopupModel(this, edit_model, profile)), opt_in_view_(NULL), - edit_view_(edit_view), + omnibox_view_(omnibox_view), location_bar_(location_bar), result_font_(font.DeriveFont(kEditFontAdjust)), result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), @@ -337,7 +337,7 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() { popup_->GetWidget()->Init(params); popup_->SetContentsView(this); popup_->MoveAbove(popup_->GetRelativeWindowForPopup( - edit_view_->GetNativeView())); + omnibox_view_->GetNativeView())); popup_->Show(); } else { // Animate the popup shrinking, but don't animate growing larger since that @@ -627,8 +627,8 @@ void AutocompletePopupContentsView::OpenIndex( const GURL url(match.destination_url); string16 keyword; const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); - edit_view_->OpenURL(url, disposition, match.transition, GURL(), index, - is_keyword_hint ? string16() : keyword); + omnibox_view_->OpenURL(url, disposition, match.transition, GURL(), index, + is_keyword_hint ? string16() : keyword); } size_t AutocompletePopupContentsView::GetIndexForPoint( diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h index 48c47bc..7673bf0 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h @@ -40,7 +40,7 @@ class AutocompletePopupContentsView : public views::View, public ui::AnimationDelegate { public: AutocompletePopupContentsView(const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, const views::View* location_bar); @@ -151,7 +151,7 @@ class AutocompletePopupContentsView : public views::View, base::WeakPtr<AutocompletePopupClass> popup_; // The edit view that invokes us. - AutocompleteEditView* edit_view_; + OmniboxView* omnibox_view_; // An object that the popup positions itself against. const views::View* location_bar_; diff --git a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc index 7abdd9a..c13f84e 100644 --- a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.cc @@ -4,15 +4,15 @@ #include "touch_autocomplete_popup_contents_view.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" +#include "third_party/skia/include/core/SkPaint.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/font.h" #include "ui/gfx/path.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -#include "third_party/skia/include/core/SkPaint.h" #include "views/view.h" @@ -53,11 +53,11 @@ int TouchAutocompleteResultView::GetFontHeight() const { TouchAutocompletePopupContentsView::TouchAutocompletePopupContentsView( const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, const views::View* location_bar) - : AutocompletePopupContentsView(font, edit_view, edit_model, profile, + : AutocompletePopupContentsView(font, omnibox_view, edit_model, profile, location_bar) { } diff --git a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h index d618d41..23f3de2 100644 --- a/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h @@ -9,8 +9,8 @@ #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h" #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h" -class AutocompleteEditView; class AutocompleteEditModel; +class OmniboxView; class Profile; namespace gfx { @@ -45,7 +45,7 @@ class TouchAutocompletePopupContentsView : public AutocompletePopupContentsView { public: TouchAutocompletePopupContentsView(const gfx::Font& font, - AutocompleteEditView* edit_view, + OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, Profile* profile, const views::View* location_bar); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 31c680f..d64fc59 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -1121,11 +1121,11 @@ void LocationBarView::Revert() { location_entry_->RevertAll(); } -const AutocompleteEditView* LocationBarView::location_entry() const { +const OmniboxView* LocationBarView::location_entry() const { return location_entry_.get(); } -AutocompleteEditView* LocationBarView::location_entry() { +OmniboxView* LocationBarView::location_entry() { return location_entry_.get(); } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 394bedf..4d6ac50 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -240,8 +240,8 @@ class LocationBarView : public LocationBar, virtual void InvalidatePageActions() OVERRIDE; virtual void SaveStateToContents(TabContents* contents) OVERRIDE; virtual void Revert() OVERRIDE; - virtual const AutocompleteEditView* location_entry() const OVERRIDE; - virtual AutocompleteEditView* location_entry() OVERRIDE; + virtual const OmniboxView* location_entry() const OVERRIDE; + virtual OmniboxView* location_entry() OVERRIDE; virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; // Overridden from LocationBarTesting: @@ -330,7 +330,7 @@ class LocationBarView : public LocationBar, #if defined(OS_WIN) scoped_ptr<OmniboxViewWin> location_entry_; #else - scoped_ptr<AutocompleteEditView> location_entry_; + scoped_ptr<OmniboxView> location_entry_; #endif // The CommandUpdater for the Browser object that corresponds to this View. diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 5d0f4a1..13b1aa3 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -425,8 +425,7 @@ void OmniboxViewViews::ClosePopup() { } void OmniboxViewViews::SetFocus() { - // In views-implementation, the focus is on textfield rather than - // AutocompleteEditView. + // In views-implementation, the focus is on textfield rather than OmniboxView. textfield_->RequestFocus(); } diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index 7fdf5e0..9e0cf6c0 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "content/common/notification_observer.h" #include "content/common/page_transition_types.h" @@ -25,8 +25,8 @@ class AutocompletePopupView; class Profile; class TabContents; -// Views-implementation of AutocompleteEditView. This is based on -// gtk implementation. The following features are not yet supported. +// Views-implementation of OmniboxView. This is based on gtk implementation. +// The following features are not yet supported. // // IME support. // LTR support. @@ -37,7 +37,7 @@ class TabContents; // Custom context menu for omnibox. // Instant. class OmniboxViewViews : public views::View, - public AutocompleteEditView, + public OmniboxView, public NotificationObserver, public views::TextfieldController { public: @@ -69,7 +69,7 @@ class OmniboxViewViews : public views::View, virtual void Layout() OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - // Implement the AutocompleteEditView interface. + // OmniboxView: virtual AutocompleteEditModel* model() OVERRIDE; virtual const AutocompleteEditModel* model() const OVERRIDE; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h index 4894960..3944c60 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h @@ -16,7 +16,7 @@ #include "base/memory/scoped_ptr.h" #include "base/win/scoped_comptr.h" #include "chrome/browser/autocomplete/autocomplete.h" -#include "chrome/browser/autocomplete/autocomplete_edit_view.h" +#include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h" #include "content/common/page_transition_types.h" @@ -25,18 +25,17 @@ #include "views/controls/menu/menu_2.h" #include "webkit/glue/window_open_disposition.h" +class AutocompleteEditController; +class AutocompleteEditModel; +class AutocompletePopupView; +class LocationBarView; class Profile; class TabContents; + namespace views { class View; } -class AutocompleteEditController; -class AutocompleteEditModel; -class AutocompleteEditView; -class AutocompletePopupView; -class LocationBarView; - // Provides the implementation of an edit control with a drop-down // autocomplete box. The box itself is implemented in autocomplete_popup.cc // This file implements the edit box and management for the popup. @@ -47,7 +46,7 @@ class OmniboxViewWin ES_NOHIDESEL> >, public CRichEditCommands<OmniboxViewWin>, public ui::SimpleMenuModel::Delegate, - public AutocompleteEditView { + public OmniboxView { public: struct State { State(const CHARRANGE& selection, @@ -83,7 +82,7 @@ class OmniboxViewWin // Returns the font. gfx::Font GetFont(); - // Implement the AutocompleteEditView interface. + // OmniboxView: virtual AutocompleteEditModel* model() { return model_.get(); } virtual const AutocompleteEditModel* model() const { return model_.get(); } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 83cf57a..aecd0ee 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -108,7 +108,6 @@ 'browser/autocomplete/autocomplete_controller_delegate.h', 'browser/autocomplete/autocomplete_edit.cc', 'browser/autocomplete/autocomplete_edit.h', - 'browser/autocomplete/autocomplete_edit_view.h', 'browser/autocomplete/autocomplete_match.cc', 'browser/autocomplete/autocomplete_match.h', 'browser/autocomplete/autocomplete_popup_model.cc', @@ -2783,6 +2782,7 @@ 'browser/ui/omnibox/location_bar.h', 'browser/ui/omnibox/location_bar_util.cc', 'browser/ui/omnibox/location_bar_util.h', + 'browser/ui/omnibox/omnibox_view.h', 'browser/ui/options/options_util.cc', 'browser/ui/options/options_util.h', 'browser/ui/panels/panel.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index bb20efa..30babb2 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -432,15 +432,15 @@ 'defines': [ 'ALLOW_IN_PROC_BROWSER_TEST' ], 'sources': [ 'browser/accessibility/accessibility_mac_uitest.mm', - 'browser/autocomplete/autocomplete_edit_view_browsertest.cc', 'browser/autofill/autofill_browsertest.cc', 'browser/browser_focus_uitest.cc', 'browser/browser_keyevents_browsertest.cc', 'browser/collected_cookies_uitest.cc', 'browser/debugger/devtools_sanity_unittest.cc', - 'browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc', 'browser/instant/instant_browsertest.cc', 'browser/notifications/notifications_interactive_uitest.cc', + 'browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc', + 'browser/ui/omnibox/omnibox_view_browsertest.cc', 'browser/ui/views/bookmarks/bookmark_bar_view_test.cc', 'browser/ui/views/find_bar_host_interactive_uitest.cc', 'browser/ui/views/tabs/tab_dragging_test.cc', diff --git a/chrome/test/test_location_bar.cc b/chrome/test/test_location_bar.cc index 9d59a0a..94ba49c 100644 --- a/chrome/test/test_location_bar.cc +++ b/chrome/test/test_location_bar.cc @@ -23,11 +23,11 @@ PageTransition::Type TestLocationBar::GetPageTransition() const { return transition_; } -const AutocompleteEditView* TestLocationBar::location_entry() const { +const OmniboxView* TestLocationBar::location_entry() const { return NULL; } -AutocompleteEditView* TestLocationBar::location_entry() { +OmniboxView* TestLocationBar::location_entry() { return NULL; } diff --git a/chrome/test/test_location_bar.h b/chrome/test/test_location_bar.h index 587d28f..e3e582b 100644 --- a/chrome/test/test_location_bar.h +++ b/chrome/test/test_location_bar.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -41,8 +41,8 @@ class TestLocationBar : public LocationBar { virtual void InvalidatePageActions() OVERRIDE {} virtual void SaveStateToContents(TabContents* contents) OVERRIDE {} virtual void Revert() OVERRIDE {} - virtual const AutocompleteEditView* location_entry() const OVERRIDE; - virtual AutocompleteEditView* location_entry() OVERRIDE; + virtual const OmniboxView* location_entry() const OVERRIDE; + virtual OmniboxView* location_entry() OVERRIDE; virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; private: |