| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 break; | 440 break; |
| 441 case OMNIBOX_FOCUS_INVISIBLE: | 441 case OMNIBOX_FOCUS_INVISIBLE: |
| 442 omnibox->SetFocus(); | 442 omnibox->SetFocus(); |
| 443 omnibox->model()->SetCaretVisibility(false); | 443 omnibox->model()->SetCaretVisibility(false); |
| 444 // If the user clicked on the fakebox, any text already in the omnibox | 444 // If the user clicked on the fakebox, any text already in the omnibox |
| 445 // should get cleared when they start typing. Selecting all the existing | 445 // should get cleared when they start typing. Selecting all the existing |
| 446 // text is a convenient way to accomplish this. It also gives a slight | 446 // text is a convenient way to accomplish this. It also gives a slight |
| 447 // visual cue to users who really understand selection state about what | 447 // visual cue to users who really understand selection state about what |
| 448 // will happen if they start typing. | 448 // will happen if they start typing. |
| 449 omnibox->SelectAll(false); | 449 omnibox->SelectAll(false); |
| 450 omnibox->ShowImeIfNeeded(); |
| 450 break; | 451 break; |
| 451 case OMNIBOX_FOCUS_NONE: | 452 case OMNIBOX_FOCUS_NONE: |
| 452 // Remove focus only if the popup is closed. This will prevent someone | 453 // Remove focus only if the popup is closed. This will prevent someone |
| 453 // from changing the omnibox value and closing the popup without user | 454 // from changing the omnibox value and closing the popup without user |
| 454 // interaction. | 455 // interaction. |
| 455 if (!omnibox->model()->popup_model()->IsOpen()) | 456 if (!omnibox->model()->popup_model()->IsOpen()) |
| 456 web_contents()->GetView()->Focus(); | 457 web_contents()->GetView()->Focus(); |
| 457 break; | 458 break; |
| 458 } | 459 } |
| 459 #endif | 460 #endif |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 void SearchTabHelper::RedirectToLocalNTP() { | 595 void SearchTabHelper::RedirectToLocalNTP() { |
| 595 // Extra parentheses to declare a variable. | 596 // Extra parentheses to declare a variable. |
| 596 content::NavigationController::LoadURLParams load_params( | 597 content::NavigationController::LoadURLParams load_params( |
| 597 (GURL(chrome::kChromeSearchLocalNtpUrl))); | 598 (GURL(chrome::kChromeSearchLocalNtpUrl))); |
| 598 load_params.referrer = content::Referrer(); | 599 load_params.referrer = content::Referrer(); |
| 599 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; | 600 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; |
| 600 // Don't push a history entry. | 601 // Don't push a history entry. |
| 601 load_params.should_replace_current_entry = true; | 602 load_params.should_replace_current_entry = true; |
| 602 web_contents_->GetController().LoadURLWithParams(load_params); | 603 web_contents_->GetController().LoadURLWithParams(load_params); |
| 603 } | 604 } |
| OLD | NEW |