diff options
29 files changed, 130 insertions, 132 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index d928e0a..c010975 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -399,7 +399,7 @@ class AutocompleteProvider // // |minimal_changes| is an optimization that lets the provider do less work // when the |input|'s text hasn't changed. See the body of - // AutocompletePopupModel::StartAutocomplete(). + // OmniboxPopupModel::StartAutocomplete(). virtual void Start(const AutocompleteInput& input, bool minimal_changes) = 0; @@ -812,7 +812,7 @@ struct AutocompleteLog { bool just_deleted_text; // The detected type of the user's input. AutocompleteInput::Type input_type; - // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). + // Selected index (if selected) or -1 (OmniboxPopupModel::kNoMatch). size_t selected_index; // ID of the tab the selected autocomplete suggestion was opened in. // Set to -1 if we haven't yet determined the destination tab. diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index 4fa8dcd..86aa384 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -9,7 +9,6 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/unpacked_installer.h" @@ -19,6 +18,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_popup_model.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_paths.h" diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 4a70a13..0cee6b2 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -15,8 +15,6 @@ #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" #include "chrome/browser/autocomplete/extension_app_provider.h" #include "chrome/browser/autocomplete/keyword_provider.h" #include "chrome/browser/autocomplete/search_provider.h" @@ -40,6 +38,8 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/sessions/restore_tab_helper.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" @@ -433,10 +433,9 @@ void AutocompleteEditModel::StartAutocomplete( ClearPopupKeywordMode(); bool keyword_is_selected = KeywordIsSelected(); - popup_->SetHoveredLine(AutocompletePopupModel::kNoMatch); - // We don't explicitly clear AutocompletePopupModel::manually_selected_match, - // as Start ends up invoking AutocompletePopupModel::OnResultChanged which - // clears it. + popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); + // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as + // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. autocomplete_controller_->Start( user_text_, GetDesiredTLD(), prevent_inline_autocomplete || just_deleted_text_ || @@ -469,7 +468,7 @@ bool AutocompleteEditModel::CanPasteAndGo(const string16& text) const { void AutocompleteEditModel::PasteAndGo() { view_->RevertAll(); view_->OpenMatch(paste_and_go_match_, CURRENT_TAB, - paste_and_go_alternate_nav_url_, AutocompletePopupModel::kNoMatch); + paste_and_go_alternate_nav_url_, OmniboxPopupModel::kNoMatch); } void AutocompleteEditModel::AcceptInput(WindowOpenDisposition disposition, @@ -508,7 +507,7 @@ void AutocompleteEditModel::AcceptInput(WindowOpenDisposition disposition, GoogleURLTracker::GoogleURLSearchCommitted(profile_); view_->OpenMatch(match, disposition, alternate_nav_url, - AutocompletePopupModel::kNoMatch); + OmniboxPopupModel::kNoMatch); } void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, @@ -532,7 +531,7 @@ void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, DCHECK(user_input_in_progress_) << "We didn't get here through the " "expected series of calls. time_user_first_modified_omnibox_ is " "not set correctly and other things may be wrong."; - if (index != AutocompletePopupModel::kNoMatch) + if (index != OmniboxPopupModel::kNoMatch) log.selected_index = index; else if (!has_temporary_text_) log.inline_autocompleted_length = inline_autocomplete_text_.length(); @@ -564,7 +563,7 @@ void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, GetInfoForCurrentText(¤t_match, NULL); const AutocompleteMatch& match = - (index == AutocompletePopupModel::kNoMatch) ? + (index == OmniboxPopupModel::kNoMatch) ? current_match : result().match_at(index); // Strip the keyword + leading space off the input. @@ -624,7 +623,7 @@ bool AutocompleteEditModel::AcceptKeyword() { is_keyword_hint_ = false; if (popup_->IsOpen()) - popup_->SetSelectedLineState(AutocompletePopupModel::KEYWORD); + popup_->SetSelectedLineState(OmniboxPopupModel::KEYWORD); else StartAutocomplete(false, true); @@ -969,8 +968,8 @@ bool AutocompleteEditModel::KeywordIsSelected() const { void AutocompleteEditModel::ClearPopupKeywordMode() const { if (popup_->IsOpen() && - popup_->selected_line_state() == AutocompletePopupModel::KEYWORD) - popup_->SetSelectedLineState(AutocompletePopupModel::NORMAL); + popup_->selected_line_state() == OmniboxPopupModel::KEYWORD) + popup_->SetSelectedLineState(OmniboxPopupModel::NORMAL); } string16 AutocompleteEditModel::DisplayTextFromUserText( diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index 06b6a06..2f7f017 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -21,9 +21,9 @@ class AutocompleteController; class AutocompleteEditController; class AutocompleteEditModel; -class AutocompletePopupModel; class AutocompleteResult; class InstantController; +class OmniboxPopupModel; class OmniboxView; class Profile; class SkBitmap; @@ -111,13 +111,13 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate { return autocomplete_controller_.get(); } - void set_popup_model(AutocompletePopupModel* popup_model) { + void set_popup_model(OmniboxPopupModel* popup_model) { popup_ = popup_model; } // TODO: The edit and popup should be siblings owned by the LocationBarView, // making this accessor unnecessary. - AutocompletePopupModel* popup_model() const { return popup_; } + OmniboxPopupModel* popup_model() const { return popup_; } AutocompleteEditController* controller() const { return controller_; } @@ -456,7 +456,7 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate { OmniboxView* view_; - AutocompletePopupModel* popup_; + OmniboxPopupModel* popup_; AutocompleteEditController* controller_; diff --git a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc index f136a4d..7c40242 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc @@ -9,7 +9,6 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" @@ -18,12 +17,13 @@ #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_popup_model.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/notification_types.h" #if defined(TOOLKIT_GTK) #include "chrome/browser/ui/gtk/browser_window_gtk.h" @@ -194,7 +194,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_PopupStaysClosed) { OmniboxView* omnibox_view = location_bar->GetLocationEntry(); AutocompleteController* autocomplete_controller = GetAutocompleteController(browser()); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); // Input a keyword query and wait for suggestions from the extension. omnibox_view->OnBeforePossibleChange(); 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 e9305bd..af07dbb 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 @@ -13,7 +13,6 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/alternate_nav_url_fetcher.h" #import "chrome/browser/app_controller_mac.h" -#import "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/chrome_to_mobile_service.h" #include "chrome/browser/chrome_to_mobile_service_factory.h" #include "chrome/browser/command_updater.h" @@ -48,6 +47,7 @@ #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" +#import "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h index 5331f6a..a2ba241 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ -#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ +#ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ +#define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ #pragma once #import <Cocoa/Cocoa.h> @@ -13,28 +13,28 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "ui/gfx/font.h" class AutocompleteEditModel; -class AutocompletePopupModel; @class NSImage; +class OmniboxPopupModel; class OmniboxView; -// Implements AutocompletePopupView using a raw NSWindow containing an +// Implements OmniboxPopupView using a raw NSWindow containing an // NSTableView. // // TODO(rohitrao): This class is set up in a way that makes testing hard. // Refactor and write unittests. http://crbug.com/9977 -class OmniboxPopupViewMac : public AutocompletePopupView { +class OmniboxPopupViewMac : public OmniboxPopupView { public: OmniboxPopupViewMac(OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, NSTextField* field); virtual ~OmniboxPopupViewMac(); - // Implement the AutocompletePopupView interface. + // Overridden from OmniboxPopupView: virtual bool IsOpen() const OVERRIDE; virtual void InvalidateLine(size_t line) OVERRIDE { // TODO(shess): Verify that there is no need to implement this. @@ -120,7 +120,7 @@ class OmniboxPopupViewMac : public AutocompletePopupView { // TODO(shess): |omnibox_view_| should already be accessible via // |field_|, or perhaps via |model_|. Consider refactoring. OmniboxView* omnibox_view_; - scoped_ptr<AutocompletePopupModel> model_; + scoped_ptr<OmniboxPopupModel> model_; NSTextField* field_; // owned by tab controller // Child window containing a matrix which implements the popup. @@ -130,4 +130,4 @@ class OmniboxPopupViewMac : public AutocompletePopupView { DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewMac); }; -#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_MAC_H_ +#endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_VIEW_MAC_H_ diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm index cc0110f..ee88adf 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm @@ -10,10 +10,10 @@ #include "base/sys_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/ui/cocoa/event_utils.h" #include "chrome/browser/ui/cocoa/image_utils.h" #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "grit/theme_resources.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" @@ -282,7 +282,7 @@ OmniboxPopupViewMac::OmniboxPopupViewMac(OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, NSTextField* field) : omnibox_view_(omnibox_view), - model_(new AutocompletePopupModel(this, edit_model)), + model_(new OmniboxPopupModel(this, edit_model)), field_(field), popup_(nil), targetPopupFrame_(NSZeroRect) { diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm index 0f35d0c..2b83b95 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm @@ -12,10 +12,10 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/ui/cocoa/event_utils.h" #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" @@ -805,7 +805,7 @@ bool OmniboxViewMac::OnDoCommandBySelector(SEL cmd) { if (cmd == @selector(insertBacktab:) && model_->popup_model()->selected_line_state() == - AutocompletePopupModel::KEYWORD) { + OmniboxPopupModel::KEYWORD) { model_->ClearKeyword(GetText()); return true; } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index ae4c929..e789462 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -19,7 +19,6 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/accessibility/accessibility_events.h" #include "chrome/browser/alternate_nav_url_fetcher.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/chrome_to_mobile_service.h" #include "chrome/browser/chrome_to_mobile_service_factory.h" #include "chrome/browser/command_updater.h" @@ -58,6 +57,7 @@ #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/gtk/zoom_bubble_gtk.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/zoom/zoom_controller.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc index 69221a0..8ed3980 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc @@ -17,13 +17,13 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/defaults.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_source.h" @@ -268,7 +268,7 @@ OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, AutocompleteEditModel* edit_model, GtkWidget* location_bar) : signal_registrar_(new ui::GtkSignalRegistrar), - model_(new AutocompletePopupModel(this, edit_model)), + model_(new OmniboxPopupModel(this, edit_model)), omnibox_view_(omnibox_view), location_bar_(location_bar), window_(gtk_window_new(GTK_WINDOW_POPUP)), @@ -539,7 +539,7 @@ void OmniboxPopupViewGtk::GetVisibleMatchForInput( if (result.match_at(index).associated_keyword.get() && model_->selected_line() == index && - model_->selected_line_state() == AutocompletePopupModel::KEYWORD) { + model_->selected_line_state() == OmniboxPopupModel::KEYWORD) { *match = result.match_at(index).associated_keyword.get(); *is_selected_keyword = true; return; diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h index 5a250a8..37edc15 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h @@ -15,7 +15,7 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "ui/base/gtk/gtk_signal.h" @@ -23,8 +23,8 @@ #include "webkit/glue/window_open_disposition.h" class AutocompleteEditModel; -class AutocompletePopupModel; class GtkThemeService; +class OmniboxPopupModel; class OmniboxView; class SkBitmap; @@ -36,7 +36,7 @@ namespace ui { class GtkSignalRegistrar; } -class OmniboxPopupViewGtk : public AutocompletePopupView, +class OmniboxPopupViewGtk : public OmniboxPopupView, public content::NotificationObserver { public: OmniboxPopupViewGtk(const gfx::Font& font, @@ -45,7 +45,7 @@ class OmniboxPopupViewGtk : public AutocompletePopupView, GtkWidget* location_bar); virtual ~OmniboxPopupViewGtk(); - // Overridden from AutocompletePopupView: + // Overridden from OmniboxPopupView: virtual bool IsOpen() const OVERRIDE; virtual void InvalidateLine(size_t line) OVERRIDE; virtual void UpdatePopupAppearance() OVERRIDE; @@ -106,7 +106,7 @@ class OmniboxPopupViewGtk : public AutocompletePopupView, GdkEventExpose*); scoped_ptr<ui::GtkSignalRegistrar> signal_registrar_; - scoped_ptr<AutocompletePopupModel> model_; + scoped_ptr<OmniboxPopupModel> model_; OmniboxView* omnibox_view_; GtkWidget* location_bar_; diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index df6738e..c9024cc 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -17,7 +17,6 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/defaults.h" @@ -29,6 +28,7 @@ #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" #include "chrome/browser/ui/gtk/view_id_util.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_source.h" @@ -1619,7 +1619,7 @@ void OmniboxViewGtk::HandleViewMoveFocus(GtkWidget* widget, } else if (model_->popup_model()->IsOpen()) { if (shift_was_pressed_ && model_->popup_model()->selected_line_state() == - AutocompletePopupModel::KEYWORD) + OmniboxPopupModel::KEYWORD) model_->ClearKeyword(GetText()); else model_->OnUpOrDownKeyPressed(shift_was_pressed_ ? -1 : 1); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h index 186cf33..8f16b4a 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h @@ -28,8 +28,8 @@ class AutocompleteEditController; class AutocompleteEditModel; -class AutocompletePopupView; class Browser; +class OmniboxPopupView; class Profile; namespace gfx { @@ -367,7 +367,7 @@ class OmniboxViewGtk : public OmniboxView, GtkTextMark* instant_mark_; scoped_ptr<AutocompleteEditModel> model_; - scoped_ptr<AutocompletePopupView> popup_view_; + scoped_ptr<OmniboxPopupView> popup_view_; AutocompleteEditController* controller_; ToolbarModel* toolbar_model_; diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/ui/omnibox/omnibox_popup_model.cc index 3e93a16..f4b5bdd 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_popup_model.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include <algorithm> @@ -12,21 +12,21 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "ui/gfx/rect.h" /////////////////////////////////////////////////////////////////////////////// -// AutocompletePopupModel +// OmniboxPopupModel -const size_t AutocompletePopupModel::kNoMatch = -1; +const size_t OmniboxPopupModel::kNoMatch = -1; -AutocompletePopupModel::AutocompletePopupModel( - AutocompletePopupView* popup_view, +OmniboxPopupModel::OmniboxPopupModel( + OmniboxPopupView* popup_view, AutocompleteEditModel* edit_model) : view_(popup_view), edit_model_(edit_model), @@ -36,14 +36,14 @@ AutocompletePopupModel::AutocompletePopupModel( edit_model->set_popup_model(this); } -AutocompletePopupModel::~AutocompletePopupModel() { +OmniboxPopupModel::~OmniboxPopupModel() { } -bool AutocompletePopupModel::IsOpen() const { +bool OmniboxPopupModel::IsOpen() const { return view_->IsOpen(); } -void AutocompletePopupModel::SetHoveredLine(size_t line) { +void OmniboxPopupModel::SetHoveredLine(size_t line) { const bool is_disabling = (line == kNoMatch); DCHECK(is_disabling || (line < result().size())); @@ -61,9 +61,9 @@ void AutocompletePopupModel::SetHoveredLine(size_t line) { view_->InvalidateLine(hovered_line_); } -void AutocompletePopupModel::SetSelectedLine(size_t line, - bool reset_to_default, - bool force) { +void OmniboxPopupModel::SetSelectedLine(size_t line, + bool reset_to_default, + bool force) { const AutocompleteResult& result = this->result(); if (result.empty()) return; @@ -129,14 +129,14 @@ void AutocompletePopupModel::SetSelectedLine(size_t line, view_->PaintUpdatesNow(); } -void AutocompletePopupModel::ResetToDefaultMatch() { +void OmniboxPopupModel::ResetToDefaultMatch() { const AutocompleteResult& result = this->result(); CHECK(!result.empty()); SetSelectedLine(result.default_match() - result.begin(), true, false); view_->OnDragCanceled(); } -void AutocompletePopupModel::Move(int count) { +void OmniboxPopupModel::Move(int count) { const AutocompleteResult& result = this->result(); if (result.empty()) return; @@ -151,7 +151,7 @@ void AutocompletePopupModel::Move(int count) { false, false); } -void AutocompletePopupModel::SetSelectedLineState(LineState state) { +void OmniboxPopupModel::SetSelectedLineState(LineState state) { DCHECK(!result().empty()); DCHECK_NE(kNoMatch, selected_line_); @@ -162,7 +162,7 @@ void AutocompletePopupModel::SetSelectedLineState(LineState state) { view_->InvalidateLine(selected_line_); } -void AutocompletePopupModel::TryDeletingCurrentItem() { +void OmniboxPopupModel::TryDeletingCurrentItem() { // We could use InfoForCurrentSelection() here, but it seems better to try // and shift-delete the actual selection, rather than any "in progress, not // yet visible" one. @@ -194,7 +194,7 @@ void AutocompletePopupModel::TryDeletingCurrentItem() { } } -const SkBitmap* AutocompletePopupModel::GetIconIfExtensionMatch( +const SkBitmap* OmniboxPopupModel::GetIconIfExtensionMatch( const AutocompleteMatch& match) const { Profile* profile = edit_model_->profile(); const TemplateURL* template_url = match.GetTemplateURL(profile); @@ -203,7 +203,7 @@ const SkBitmap* AutocompletePopupModel::GetIconIfExtensionMatch( template_url->GetExtensionId()) : NULL; } -void AutocompletePopupModel::OnResultChanged() { +void OmniboxPopupModel::OnResultChanged() { const AutocompleteResult& result = this->result(); selected_line_ = result.default_match() == result.end() ? kNoMatch : static_cast<size_t>(result.default_match() - result.begin()); diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/ui/omnibox/omnibox_popup_model.h index f54947b..907fb39 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_model.h +++ b/chrome/browser/ui/omnibox/omnibox_popup_model.h @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ -#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ +#ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ +#define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ #pragma once #include "base/basictypes.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" -class AutocompletePopupView; +class OmniboxPopupView; class SkBitmap; -class AutocompletePopupModel { +class OmniboxPopupModel { public: // See selected_line_state_ for details. enum LineState { @@ -21,14 +21,14 @@ class AutocompletePopupModel { KEYWORD }; - AutocompletePopupModel(AutocompletePopupView* popup_view, - AutocompleteEditModel* edit_model); - ~AutocompletePopupModel(); + OmniboxPopupModel(OmniboxPopupView* popup_view, + AutocompleteEditModel* edit_model); + ~OmniboxPopupModel(); // Returns true if the popup is currently open. bool IsOpen() const; - AutocompletePopupView* view() const { return view_; } + OmniboxPopupView* view() const { return view_; } // Returns the AutocompleteController used by this popup. AutocompleteController* autocomplete_controller() const { @@ -105,7 +105,7 @@ class AutocompletePopupModel { static const size_t kNoMatch; private: - AutocompletePopupView* view_; + OmniboxPopupView* view_; AutocompleteEditModel* edit_model_; @@ -125,7 +125,7 @@ class AutocompletePopupModel { // The match the user has manually chosen, if any. AutocompleteResult::Selection manually_selected_match_; - DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); + DISALLOW_COPY_AND_ASSIGN(OmniboxPopupModel); }; -#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ +#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_MODEL_H_ diff --git a/chrome/browser/autocomplete/autocomplete_popup_view.h b/chrome/browser/ui/omnibox/omnibox_popup_view.h index 19b36ec..6943e2a 100644 --- a/chrome/browser/autocomplete/autocomplete_popup_view.h +++ b/chrome/browser/ui/omnibox/omnibox_popup_view.h @@ -1,15 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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 AutocompletePopupView. Each toolkit +// This file defines the interface class OmniboxPopupView. Each toolkit // will implement the popup view differently, so that code is inheriently -// platform specific. However, the AutocompletePopupModel needs to do some +// platform specific. However, the OmniboxPopupModel 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_POPUP_VIEW_H_ -#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ +#ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_ +#define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_ #pragma once #include "build/build_config.h" @@ -18,9 +18,9 @@ namespace gfx { class Rect; } -class AutocompletePopupView { +class OmniboxPopupView { public: - virtual ~AutocompletePopupView() {} + virtual ~OmniboxPopupView() {} // Returns true if the popup is currently open. virtual bool IsOpen() const = 0; @@ -47,4 +47,4 @@ class AutocompletePopupView { virtual void OnDragCanceled() = 0; }; -#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ +#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_ diff --git a/chrome/browser/ui/omnibox/omnibox_view.h b/chrome/browser/ui/omnibox/omnibox_view.h index d57727f..2ef5797 100644 --- a/chrome/browser/ui/omnibox/omnibox_view.h +++ b/chrome/browser/ui/omnibox/omnibox_view.h @@ -165,10 +165,10 @@ class OmniboxView { // Returns the gfx::NativeView of the edit view. virtual gfx::NativeView GetNativeView() const = 0; - // Gets the relative window for the pop up window of AutocompletePopupView. - // The pop up window will be shown under the relative window. When an IME - // is attached to the rich edit control, the IME window is the relative - // window. Otherwise, the top-most window is the relative window. + // Gets the relative window for the pop up window of OmniboxPopupView. The pop + // up window will be shown under the relative window. When an IME is attached + // to the rich edit control, the IME window is the relative window. Otherwise, + // the top-most window is the relative window. virtual gfx::NativeView GetRelativeWindowForPopup() const = 0; // Returns the command updater for this view. diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 3d97a2e..d382731 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -13,7 +13,6 @@ #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/autocomplete/history_quick_provider.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" @@ -26,6 +25,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_popup_model.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" @@ -573,7 +573,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void DesiredTLDTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Test ctrl-Enter. @@ -605,7 +605,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void EnterToSearchTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Test Enter to search. @@ -649,7 +649,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void EscapeToDefaultMatchTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Input something to trigger inline autocomplete. @@ -887,7 +887,7 @@ class OmniboxViewTest : public InProcessBrowserTest, omnibox_view->SetUserText(string16()); ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys)); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model->IsOpen()); ASSERT_EQ(ASCIIToUTF16("foobar.com"), omnibox_view->GetText()); omnibox_view->model()->OnUpOrDownKeyPressed(1); @@ -937,7 +937,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void NonSubstitutingKeywordTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); Profile* profile = browser()->profile(); @@ -998,7 +998,7 @@ class OmniboxViewTest : public InProcessBrowserTest, OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); string16 old_text = omnibox_view->GetText(); @@ -1139,7 +1139,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void TabTraverseResultsTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Input something to trigger results. @@ -1251,7 +1251,7 @@ class OmniboxViewTest : public InProcessBrowserTest, void CtrlKeyPressedWithInlineAutocompleteTest() { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); // Input something to trigger inline autocomplete. @@ -1597,7 +1597,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, PrimarySelection) { IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_PasteReplacingAll) { OmniboxView* omnibox_view = NULL; ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view)); - AutocompletePopupModel* popup_model = omnibox_view->model()->popup_model(); + OmniboxPopupModel* popup_model = omnibox_view->model()->popup_model(); ASSERT_TRUE(popup_model); SetClipboardText(kSearchText); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 3a4bff5..12bc6c4 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -14,8 +14,6 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/devtools_window.h" @@ -37,6 +35,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_menu_model.h" 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 b8c54f9..a3315690 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -12,7 +12,6 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/alternate_nav_url_fetcher.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/chrome_to_mobile_service.h" #include "chrome/browser/chrome_to_mobile_service_factory.h" #include "chrome/browser/defaults.h" @@ -29,6 +28,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/browser_dialogs.h" diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc index 79cc6c2..75cf9dd 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc @@ -12,7 +12,6 @@ #include "base/compiler_specific.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" @@ -102,7 +101,7 @@ OmniboxPopupContentsView::OmniboxPopupContentsView( OmniboxView* omnibox_view, AutocompleteEditModel* edit_model, views::View* location_bar) - : model_(new AutocompletePopupModel(this, edit_model)), + : model_(new OmniboxPopupModel(this, edit_model)), omnibox_view_(omnibox_view), profile_(edit_model->profile()), location_bar_(location_bar), @@ -169,7 +168,7 @@ void OmniboxPopupContentsView::LayoutChildren() { } //////////////////////////////////////////////////////////////////////////////// -// OmniboxPopupContentsView, AutocompletePopupView overrides: +// OmniboxPopupContentsView, OmniboxPopupView overrides: bool OmniboxPopupContentsView::IsOpen() const { return popup_ != NULL; @@ -182,7 +181,7 @@ void OmniboxPopupContentsView::InvalidateLine(size_t line) { if (HasMatchAt(line) && GetMatchAtIndex(line).associated_keyword.get()) { result->ShowKeyword(IsSelectedIndex(line) && - model_->selected_line_state() == AutocompletePopupModel::KEYWORD); + model_->selected_line_state() == OmniboxPopupModel::KEYWORD); } } @@ -368,7 +367,7 @@ void OmniboxPopupContentsView::OnMouseEntered( void OmniboxPopupContentsView::OnMouseExited( const views::MouseEvent& event) { - model_->SetHoveredLine(AutocompletePopupModel::kNoMatch); + model_->SetHoveredLine(OmniboxPopupModel::kNoMatch); } ui::GestureStatus OmniboxPopupContentsView::OnGestureEvent( @@ -516,7 +515,7 @@ void OmniboxPopupContentsView::OpenIndex(size_t index, size_t OmniboxPopupContentsView::GetIndexForPoint( const gfx::Point& point) { if (!HitTest(point)) - return AutocompletePopupModel::kNoMatch; + return OmniboxPopupModel::kNoMatch; int nb_match = model_->result().size(); DCHECK(nb_match <= child_count()); @@ -527,7 +526,7 @@ size_t OmniboxPopupContentsView::GetIndexForPoint( if (child->HitTest(point_in_child_coords)) return i; } - return AutocompletePopupModel::kNoMatch; + return OmniboxPopupModel::kNoMatch; } gfx::Rect OmniboxPopupContentsView::CalculateTargetBounds(int h) { diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h index d1e58eb..97b148b 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h @@ -8,8 +8,8 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/autocomplete/autocomplete.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" -#include "chrome/browser/autocomplete/autocomplete_popup_view.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_result_view_model.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/slide_animation.h" @@ -29,7 +29,7 @@ class BubbleBorder; // A view representing the contents of the autocomplete popup. class OmniboxPopupContentsView : public views::View, public OmniboxResultViewModel, - public AutocompletePopupView, + public OmniboxPopupView, public ui::AnimationDelegate { public: // Creates the appropriate type of omnibox dropdown for the @@ -46,7 +46,7 @@ class OmniboxPopupContentsView : public views::View, virtual void LayoutChildren(); - // Overridden from AutocompletePopupView: + // Overridden from OmniboxPopupView: virtual bool IsOpen() const OVERRIDE; virtual void InvalidateLine(size_t line) OVERRIDE; virtual void UpdatePopupAppearance() OVERRIDE; @@ -101,7 +101,7 @@ class OmniboxPopupContentsView : public views::View, // the view hierarchy does not "accidentally" trigger this. virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; - scoped_ptr<AutocompletePopupModel> model_; + scoped_ptr<OmniboxPopupModel> model_; private: class AutocompletePopupWidget; @@ -130,8 +130,8 @@ class OmniboxPopupContentsView : public views::View, void OpenIndex(size_t index, WindowOpenDisposition disposition); // Find the index of the match under the given |point|, specified in window - // coordinates. Returns AutocompletePopupModel::kNoMatch if there isn't a - // match at the specified point. + // coordinates. Returns OmniboxPopupModel::kNoMatch if there isn't a match at + // the specified point. size_t GetIndexForPoint(const gfx::Point& point); // Processes a located event (e.g. mouse/gesture) and sets the selection/hover diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index e989109..f2f4f7a 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc @@ -14,7 +14,7 @@ #include <algorithm> // NOLINT #include "base/i18n/bidi_line_iterator.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_result_view_model.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 433bf6b..c0acec3 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -11,9 +11,9 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/command_updater.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" @@ -292,7 +292,7 @@ bool OmniboxViewViews::HandleAfterKeyEvent(const views::KeyEvent& event, } else if (model_->popup_model()->IsOpen()) { if (event.IsShiftDown() && model_->popup_model()->selected_line_state() == - AutocompletePopupModel::KEYWORD) { + OmniboxPopupModel::KEYWORD) { model_->ClearKeyword(GetText()); } else { model_->OnUpOrDownKeyPressed(event.IsShiftDown() ? -1 : 1); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index f2822d5..fa5ba4a 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -24,8 +24,8 @@ class AutocompleteEditController; class AutocompleteEditModel; -class AutocompletePopupView; class LocationBarView; +class OmniboxPopupView; class Profile; namespace ui { @@ -193,7 +193,7 @@ class OmniboxViewViews bool popup_window_mode_; scoped_ptr<AutocompleteEditModel> model_; - scoped_ptr<AutocompletePopupView> popup_view_; + scoped_ptr<OmniboxPopupView> popup_view_; AutocompleteEditController* controller_; ToolbarModel* toolbar_model_; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index afbbce6..a317a82 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -25,13 +25,13 @@ #include "base/win/windows_version.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/autocomplete/autocomplete_match.h" -#include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/autocomplete/keyword_provider.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/omnibox/omnibox_popup_model.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" #include "chrome/common/chrome_notification_types.h" @@ -929,8 +929,8 @@ gfx::NativeView OmniboxViewWin::GetNativeView() const { gfx::NativeView OmniboxViewWin::GetRelativeWindowForNativeView( gfx::NativeView edit_native_view) { // When an IME is attached to the rich-edit control, retrieve its window - // handle, and the popup window of AutocompletePopupView will be shown - // under the IME windows. + // handle, and the popup window of OmniboxPopupView will be shown under the + // IME windows. // Otherwise, the popup window will be shown under top-most windows. // TODO(hbono): http://b/1111369 if we exclude this popup window from the // display area of IME windows, this workaround becomes unnecessary. @@ -2119,7 +2119,7 @@ bool OmniboxViewWin::OnKeyDownOnlyWritable(TCHAR key, model_->AcceptKeyword(); } else if (shift_pressed && model_->popup_model()->selected_line_state() == - AutocompletePopupModel::KEYWORD) { + OmniboxPopupModel::KEYWORD) { model_->ClearKeyword(GetText()); } else { model_->OnUpOrDownKeyPressed(shift_pressed ? -count : count); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.h b/chrome/browser/ui/views/omnibox/omnibox_view_win.h index 019aa41..e6da2c7 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.h @@ -27,8 +27,8 @@ class AutocompleteEditController; class AutocompleteEditModel; -class AutocompletePopupView; class LocationBarView; +class OmniboxPopupView; namespace views { class MenuRunner; @@ -408,7 +408,7 @@ class OmniboxViewWin scoped_ptr<AutocompleteEditModel> model_; - scoped_ptr<AutocompletePopupView> popup_view_; + scoped_ptr<OmniboxPopupView> popup_view_; AutocompleteEditController* controller_; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 74e9b5b..690ef24 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -125,9 +125,6 @@ 'browser/autocomplete/autocomplete_field_trial.h', 'browser/autocomplete/autocomplete_match.cc', 'browser/autocomplete/autocomplete_match.h', - 'browser/autocomplete/autocomplete_popup_model.cc', - 'browser/autocomplete/autocomplete_popup_model.h', - 'browser/autocomplete/autocomplete_popup_view.h', 'browser/autocomplete/builtin_provider.cc', 'browser/autocomplete/builtin_provider.h', 'browser/autocomplete/extension_app_provider.cc', @@ -3171,6 +3168,9 @@ 'browser/ui/omnibox/location_bar.h', 'browser/ui/omnibox/location_bar_util.cc', 'browser/ui/omnibox/location_bar_util.h', + 'browser/ui/omnibox/omnibox_popup_model.cc', + 'browser/ui/omnibox/omnibox_popup_model.h', + 'browser/ui/omnibox/omnibox_popup_view.h', 'browser/ui/omnibox/omnibox_view.cc', 'browser/ui/omnibox/omnibox_view.h', 'browser/ui/options/options_util.cc', |