OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 void LocationBarView::OnFocus() { | 348 void LocationBarView::OnFocus() { |
349 // Focus the view widget first which implements accessibility for Chrome OS. | 349 // Focus the view widget first which implements accessibility for Chrome OS. |
350 GetWidget()->NotifyAccessibilityEvent( | 350 GetWidget()->NotifyAccessibilityEvent( |
351 this, ui::AccessibilityTypes::EVENT_FOCUS, false); | 351 this, ui::AccessibilityTypes::EVENT_FOCUS, false); |
352 | 352 |
353 // Then focus the native location view which implements accessibility for | 353 // Then focus the native location view which implements accessibility for |
354 // Windows. | 354 // Windows. |
355 FocusLocation(true); | 355 location_entry_->SetFocus(); |
356 } | 356 } |
357 | 357 |
358 void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action, | 358 void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action, |
359 bool preview_enabled) { | 359 bool preview_enabled) { |
360 if (mode_ != NORMAL) | 360 if (mode_ != NORMAL) |
361 return; | 361 return; |
362 | 362 |
363 DCHECK(page_action); | 363 DCHECK(page_action); |
364 TabContents* contents = GetTabContentsFromDelegate(delegate_); | 364 TabContents* contents = GetTabContentsFromDelegate(delegate_); |
365 | 365 |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 content::PageTransition LocationBarView::GetPageTransition() const { | 1116 content::PageTransition LocationBarView::GetPageTransition() const { |
1117 return transition_; | 1117 return transition_; |
1118 } | 1118 } |
1119 | 1119 |
1120 void LocationBarView::AcceptInput() { | 1120 void LocationBarView::AcceptInput() { |
1121 location_entry_->model()->AcceptInput(CURRENT_TAB, false); | 1121 location_entry_->model()->AcceptInput(CURRENT_TAB, false); |
1122 } | 1122 } |
1123 | 1123 |
1124 void LocationBarView::FocusLocation(bool select_all) { | 1124 void LocationBarView::FocusLocation(bool select_all) { |
1125 location_entry_->SetFocus(); | 1125 location_entry_->SetFocus(); |
1126 location_entry_->SelectAll(select_all); | 1126 if (select_all) |
| 1127 location_entry_->SelectAll(true); |
1127 } | 1128 } |
1128 | 1129 |
1129 void LocationBarView::FocusSearch() { | 1130 void LocationBarView::FocusSearch() { |
1130 location_entry_->SetFocus(); | 1131 location_entry_->SetFocus(); |
1131 location_entry_->SetForcedQuery(); | 1132 location_entry_->SetForcedQuery(); |
1132 } | 1133 } |
1133 | 1134 |
1134 void LocationBarView::SaveStateToContents(TabContents* contents) { | 1135 void LocationBarView::SaveStateToContents(TabContents* contents) { |
1135 location_entry_->SaveStateToTab(contents); | 1136 location_entry_->SaveStateToTab(contents); |
1136 } | 1137 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 !suggested_text_view_->GetText().empty(); | 1230 !suggested_text_view_->GetText().empty(); |
1230 } | 1231 } |
1231 | 1232 |
1232 #if !defined(USE_AURA) | 1233 #if !defined(USE_AURA) |
1233 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1234 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1234 CHECK(!views::Widget::IsPureViews()); | 1235 CHECK(!views::Widget::IsPureViews()); |
1235 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1236 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1236 } | 1237 } |
1237 #endif | 1238 #endif |
1238 #endif | 1239 #endif |
OLD | NEW |