Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 9 #include "chrome/browser/ui/search/search_model.h" | 9 #include "chrome/browser/ui/search/search_model.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 | 53 |
| 54 if (model_->mode().is_ntp()) { | 54 if (model_->mode().is_ntp()) { |
| 55 if (edit_model->user_input_in_progress()) | 55 if (edit_model->user_input_in_progress()) |
| 56 model_->SetMode(Mode(Mode::MODE_SEARCH, true)); | 56 model_->SetMode(Mode(Mode::MODE_SEARCH, true)); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 Mode::Type mode = Mode::MODE_DEFAULT; | 60 Mode::Type mode = Mode::MODE_DEFAULT; |
| 61 GURL url(web_contents()->GetURL()); | 61 GURL url(web_contents()->GetURL()); |
| 62 if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec()) || | 62 if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec()) || |
| 63 edit_model->has_focus()) { | 63 (edit_model->has_focus() && edit_model->user_input_in_progress())) { |
|
dhollowa
2012/07/20 00:34:09
Until zero-suggest lands, the presence of the sugg
| |
| 64 mode = Mode::MODE_SEARCH; | 64 mode = Mode::MODE_SEARCH; |
| 65 } | 65 } |
| 66 model_->SetMode(Mode(mode, true)); | 66 model_->SetMode(Mode(mode, true)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SearchTabHelper::NavigateToPendingEntry( | 69 void SearchTabHelper::NavigateToPendingEntry( |
| 70 const GURL& url, | 70 const GURL& url, |
| 71 content::NavigationController::ReloadType reload_type) { | 71 content::NavigationController::ReloadType reload_type) { |
| 72 if (!is_search_enabled_) | 72 if (!is_search_enabled_) |
| 73 return; | 73 return; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 89 Mode::Type type = Mode::MODE_DEFAULT; | 89 Mode::Type type = Mode::MODE_DEFAULT; |
| 90 if (IsNTP(url)) | 90 if (IsNTP(url)) |
| 91 type = Mode::MODE_NTP; | 91 type = Mode::MODE_NTP; |
| 92 else if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec())) | 92 else if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec())) |
| 93 type = Mode::MODE_SEARCH; | 93 type = Mode::MODE_SEARCH; |
| 94 model_->SetMode(Mode(type, true)); | 94 model_->SetMode(Mode(type, true)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace search | 97 } // namespace search |
| 98 } // namespace chrome | 98 } // namespace chrome |
| OLD | NEW |