Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
index 357dec6fb42cf327d83850fc045d2fc3f531c707..131e1b7ac98d913da62533372687732eb704ef57 100644 |
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
@@ -224,12 +224,9 @@ OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, |
CommandUpdater* command_updater, |
bool popup_window_mode, |
LocationBarView* location_bar) |
- : textfield_(NULL), |
+ : OmniboxView(profile, controller, toolbar_model, command_updater), |
+ textfield_(NULL), |
popup_window_mode_(popup_window_mode), |
- model_(new OmniboxEditModel(this, controller, profile)), |
- controller_(controller), |
- toolbar_model_(toolbar_model), |
- command_updater_(command_updater), |
security_level_(ToolbarModel::NONE), |
ime_composing_before_change_(false), |
delete_at_end_pressed_(false), |
@@ -468,14 +465,6 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
//////////////////////////////////////////////////////////////////////////////// |
// OmniboxViewViews, AutocopmleteEditView implementation: |
-OmniboxEditModel* OmniboxViewViews::model() { |
- return model_.get(); |
-} |
- |
-const OmniboxEditModel* OmniboxViewViews::model() const { |
- return model_.get(); |
-} |
- |
void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
DCHECK(tab); |
@@ -529,43 +518,11 @@ void OmniboxViewViews::Update(const WebContents* contents) { |
} |
} |
-void OmniboxViewViews::OpenMatch(const AutocompleteMatch& match, |
- WindowOpenDisposition disposition, |
- const GURL& alternate_nav_url, |
- size_t selected_line) { |
- if (!match.destination_url.is_valid()) |
- return; |
- |
- model_->OpenMatch(match, disposition, alternate_nav_url, selected_line); |
-} |
- |
string16 OmniboxViewViews::GetText() const { |
// TODO(oshima): IME support |
return textfield_->text(); |
} |
-bool OmniboxViewViews::IsEditingOrEmpty() const { |
- return model_->user_input_in_progress() || (GetTextLength() == 0); |
-} |
- |
-int OmniboxViewViews::GetIcon() const { |
- return IsEditingOrEmpty() ? |
- AutocompleteMatch::TypeToIcon(model_->CurrentTextType()) : |
- toolbar_model_->GetIcon(); |
-} |
- |
-void OmniboxViewViews::SetUserText(const string16& text) { |
- SetUserText(text, text, true); |
-} |
- |
-void OmniboxViewViews::SetUserText(const string16& text, |
- const string16& display_text, |
- bool update_popup) { |
- model_->SetUserText(text); |
- SetWindowTextAndCaretPos(display_text, display_text.length(), update_popup, |
- true); |
-} |
- |
void OmniboxViewViews::SetWindowTextAndCaretPos(const string16& text, |
size_t caret_pos, |
bool update_popup, |
@@ -617,12 +574,6 @@ void OmniboxViewViews::SelectAll(bool reversed) { |
textfield_->SelectAll(reversed); |
} |
-void OmniboxViewViews::RevertAll() { |
- ClosePopup(); |
- model_->Revert(); |
- TextChanged(); |
-} |
- |
void OmniboxViewViews::UpdatePopup() { |
model_->SetInputInProgress(true); |
if (ime_candidate_window_open_) |
@@ -640,10 +591,6 @@ void OmniboxViewViews::UpdatePopup() { |
model_->StartAutocomplete(!sel.is_empty(), no_inline_autocomplete); |
} |
-void OmniboxViewViews::ClosePopup() { |
- model_->StopAutocomplete(); |
-} |
- |
void OmniboxViewViews::SetFocus() { |
// In views-implementation, the focus is on textfield rather than OmniboxView. |
textfield_->RequestFocus(); |
@@ -729,10 +676,6 @@ gfx::NativeView OmniboxViewViews::GetRelativeWindowForPopup() const { |
return GetWidget()->GetTopLevelWidget()->GetNativeView(); |
} |
-CommandUpdater* OmniboxViewViews::GetCommandUpdater() { |
- return command_updater_; |
-} |
- |
void OmniboxViewViews::SetInstantSuggestion(const string16& input, |
bool animate_to_complete) { |
#if defined(OS_WIN) || defined(USE_AURA) |
@@ -912,6 +855,10 @@ size_t OmniboxViewViews::GetTextLength() const { |
return textfield_->text().length(); |
} |
+int OmniboxViewViews::GetOmniboxTextLength() const { |
+ return static_cast<int>(GetTextLength()); |
+} |
+ |
void OmniboxViewViews::EmphasizeURLComponents() { |
// See whether the contents are a URL with a non-empty host portion, which we |
// should emphasize. To check for a URL, rather than using the type returned |
@@ -947,11 +894,6 @@ void OmniboxViewViews::EmphasizeURLComponents() { |
} |
} |
-void OmniboxViewViews::TextChanged() { |
- EmphasizeURLComponents(); |
- model_->OnChanged(); |
-} |
- |
void OmniboxViewViews::SetTextAndSelectedRange(const string16& text, |
const ui::Range& range) { |
if (text != GetText()) |