| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| 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 5ee8ed62d0f2aaa6f922030217b99a16da82e1d2..b4952176833d82236c446eab22a8ee0829539bb4 100644
|
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| @@ -57,7 +57,6 @@
|
| #include "ui/gfx/image/image.h"
|
| #include "ui/gfx/skia_util.h"
|
| #include "ui/views/controls/label.h"
|
| -#include "ui/views/controls/textfield/native_textfield_views.h"
|
| #include "ui/views/drag_utils.h"
|
|
|
| #if !defined(OS_CHROMEOS)
|
| @@ -77,6 +76,12 @@ TabContents* GetTabContentsFromDelegate(LocationBarView::Delegate* delegate) {
|
| return wrapper ? wrapper->tab_contents() : NULL;
|
| }
|
|
|
| +// A utility function to cast OmniboxView to OmniboxViewViews.
|
| +OmniboxViewViews* AsViews(OmniboxView* view) {
|
| + DCHECK(views::Widget::IsPureViews());
|
| + return static_cast<OmniboxViewViews*>(view);
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -134,7 +139,6 @@ LocationBarView::LocationBarView(Browser* browser,
|
| template_url_service_(NULL),
|
| animation_offset_(0) {
|
| set_id(VIEW_ID_LOCATION_BAR);
|
| - set_focusable(true);
|
|
|
| if (mode_ == NORMAL) {
|
| painter_.reset(
|
| @@ -193,6 +197,7 @@ void LocationBarView::Init() {
|
| browser_->command_updater(),
|
| mode_ == POPUP,
|
| this));
|
| + SetLocationEntryFocusable(true);
|
|
|
| location_entry_view_ = location_entry_->AddToView(this);
|
| location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE);
|
| @@ -444,6 +449,19 @@ string16 LocationBarView::GetInstantSuggestion() const {
|
| }
|
| #endif
|
|
|
| +void LocationBarView::SetLocationEntryFocusable(bool focusable) {
|
| + if (views::Widget::IsPureViews())
|
| + AsViews(location_entry_.get())->SetLocationEntryFocusable(focusable);
|
| + else
|
| + set_focusable(focusable);
|
| +}
|
| +
|
| +bool LocationBarView::IsLocationEntryFocusableInRootView() const {
|
| + return views::Widget::IsPureViews() ?
|
| + AsViews(location_entry_.get())->IsLocationEntryFocusableInRootView() :
|
| + views::View::IsFocusableInRootView();
|
| +}
|
| +
|
| gfx::Size LocationBarView::GetPreferredSize() {
|
| return gfx::Size(0, GetThemeProvider()->GetBitmapNamed(mode_ == POPUP ?
|
| IDR_LOCATIONBG_POPUPMODE_CENTER : IDR_LOCATIONBG_C)->height());
|
|
|