diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 20:18:54 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 20:18:54 +0000 |
commit | 0a6dc3a6ca8fd3e0d85a45fc99c646e4c68d1d6a (patch) | |
tree | 8f23cd8372918518ee812a007156497a07a41bb4 /chrome | |
parent | 5f6791666943fb22e36717050383414136e5e9fc (diff) | |
download | chromium_src-0a6dc3a6ca8fd3e0d85a45fc99c646e4c68d1d6a.zip chromium_src-0a6dc3a6ca8fd3e0d85a45fc99c646e4c68d1d6a.tar.gz chromium_src-0a6dc3a6ca8fd3e0d85a45fc99c646e4c68d1d6a.tar.bz2 |
Reverting 27113, it breaks the ChomeOS build.
TBR=ben
Review URL: http://codereview.chromium.org/231022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
10 files changed, 25 insertions, 24 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index 7b29b7f..6a8c6d6 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -47,6 +47,9 @@ class AutocompleteEditController { // the edit is guaranteed to be showing the permanent text. virtual void OnInputInProgress(bool in_progress) = 0; + // Called whenever the autocomplete edit gets focused. + virtual void OnSetFocus() = 0; + // Returns the favicon of the current page. virtual SkBitmap GetFavIcon() const = 0; diff --git a/chrome/browser/autocomplete/autocomplete_edit_view.h b/chrome/browser/autocomplete/autocomplete_edit_view.h index cdca4c8..cba7342 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view.h @@ -128,10 +128,6 @@ class AutocompleteEditView { // Returns the gfx::NativeView of the edit view. virtual gfx::NativeView GetNativeView() const = 0; - - // Returns the gfx::NativeView of the edit view that should receive focus when - // the location bar is focused. - virtual gfx::NativeView GetFocusNativeView() const = 0; }; #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_H_ diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 2798fc2..6dfb45d 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -505,10 +505,6 @@ gfx::NativeView AutocompleteEditViewGtk::GetNativeView() const { return alignment_.get(); } -gfx::NativeView AutocompleteEditViewGtk::GetFocusNativeView() const { - return text_view_; -} - void AutocompleteEditViewGtk::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { @@ -760,6 +756,7 @@ gboolean AutocompleteEditViewGtk::HandleViewFocusIn() { GdkModifierType modifiers; gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers); model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0); + controller_->OnSetFocus(); // TODO(deanm): Some keyword hit business, etc here. return FALSE; // Continue propagation. diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index b9c9280..3f5c87a 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -110,7 +110,6 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, virtual void OnBeforePossibleChange(); virtual bool OnAfterPossibleChange(); virtual gfx::NativeView GetNativeView() const; - virtual gfx::NativeView GetFocusNativeView() const; // Overridden from NotificationObserver: virtual void Observe(NotificationType type, diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index b293d8b..56d7cee 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -89,7 +89,6 @@ class AutocompleteEditViewMac : public AutocompleteEditView, virtual void OnBeforePossibleChange(); virtual bool OnAfterPossibleChange(); virtual gfx::NativeView GetNativeView() const; - virtual gfx::NativeView GetFocusNativeView() const; // Implement the AutocompleteTextFieldObserver interface. virtual void OnControlKeyChanged(bool pressed); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index 051e7ac..ed26081 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -550,10 +550,6 @@ gfx::NativeView AutocompleteEditViewMac::GetNativeView() const { return field_; } -gfx::NativeView AutocompleteEditViewMac::GetFocusNativeView() const { - return field_; -} - void AutocompleteEditViewMac::OnUpOrDownKeyPressed(bool up, bool by_page) { // We should only arrive here when the field is focussed. DCHECK(IsFirstResponder()); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 1ada16a..e6643f3 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -869,10 +869,6 @@ gfx::NativeView AutocompleteEditViewWin::GetNativeView() const { return m_hWnd; } -gfx::NativeView AutocompleteEditViewWin::GetFocusNativeView() const { - return m_hWnd; -} - void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { if (CanPasteAndGo(text)) model_->PasteAndGo(); @@ -1640,6 +1636,15 @@ void AutocompleteEditViewWin::OnPaste() { } void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) { + views::FocusManager* focus_manager = parent_view_->GetFocusManager(); + if (focus_manager) { + // Notify the FocusManager that the focused view is now the location bar + // (our parent view). + focus_manager->SetFocusedView(parent_view_); + } else { + NOTREACHED(); + } + model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0); // Notify controller if it needs to show hint UI of some kind. diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h index a4cf616..8946c4c 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h @@ -120,7 +120,6 @@ class AutocompleteEditViewWin virtual void OnBeforePossibleChange(); virtual bool OnAfterPossibleChange(); virtual gfx::NativeView GetNativeView() const; - virtual gfx::NativeView GetFocusNativeView() const; // Exposes custom IAccessible implementation to the overall MSAA hierarchy. IAccessible* GetIAccessible(); diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 0bff973..4becb2f 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -157,8 +157,6 @@ void LocationBarView::Init() { location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE); AddChildView(location_entry_view_); location_entry_view_->set_focus_view(this); - location_entry_view_->set_focus_native_view(location_entry_-> - GetFocusNativeView()); location_entry_view_->Attach( #if defined(OS_WIN) location_entry_->m_hWnd @@ -292,9 +290,8 @@ void LocationBarView::InvalidatePageActions() { } void LocationBarView::Focus() { - // Forward the focus to the NativeViewHost that will focus the right - // native-view. - location_entry_view_->Focus(); + // Focus the location entry native view. + location_entry_->SetFocus(); } void LocationBarView::SetProfile(Profile* profile) { @@ -420,6 +417,15 @@ void LocationBarView::OnChanged() { DoLayout(false); } +void LocationBarView::OnSetFocus() { + views::FocusManager* focus_manager = GetFocusManager(); + if (!focus_manager) { + NOTREACHED(); + return; + } + focus_manager->SetFocusedView(this); +} + SkBitmap LocationBarView::GetFavIcon() const { DCHECK(delegate_); DCHECK(delegate_->GetTabContents()); diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index e60edc9..343e7e6 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -125,6 +125,7 @@ class LocationBarView : public LocationBar, virtual void OnInputInProgress(bool in_progress) { delegate_->OnInputInProgress(in_progress); } + virtual void OnSetFocus(); virtual SkBitmap GetFavIcon() const; virtual std::wstring GetTitle() const; |