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/views/ash/app_list/search_builder.h" | 5 #include "chrome/browser/ui/views/ash/app_list/search_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 service->GetInstalledApp(match.destination_url); | 202 service->GetInstalledApp(match.destination_url); |
203 if (extension) | 203 if (extension) |
204 extension_utils::OpenExtension(profile_, extension, event_flags); | 204 extension_utils::OpenExtension(profile_, extension, event_flags); |
205 } else { | 205 } else { |
206 WindowOpenDisposition disposition = | 206 WindowOpenDisposition disposition = |
207 browser::DispositionFromEventFlags(event_flags); | 207 browser::DispositionFromEventFlags(event_flags); |
208 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); | 208 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); |
209 | 209 |
210 if (disposition == CURRENT_TAB) { | 210 if (disposition == CURRENT_TAB) { |
211 // If current tab is not NTP, change disposition to NEW_FOREGROUND_TAB. | 211 // If current tab is not NTP, change disposition to NEW_FOREGROUND_TAB. |
212 const GURL& url = browser->GetSelectedWebContents() ? | 212 const GURL& url = browser->GetActiveWebContents() ? |
213 browser->GetSelectedWebContents()->GetURL() : GURL(); | 213 browser->GetActiveWebContents()->GetURL() : GURL(); |
214 if (!url.SchemeIs(chrome::kChromeUIScheme) || | 214 if (!url.SchemeIs(chrome::kChromeUIScheme) || |
215 url.host() != chrome::kChromeUINewTabHost) { | 215 url.host() != chrome::kChromeUINewTabHost) { |
216 disposition = NEW_FOREGROUND_TAB; | 216 disposition = NEW_FOREGROUND_TAB; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 // TODO(xiyuan): What should we do for alternate url case? | 220 // TODO(xiyuan): What should we do for alternate url case? |
221 browser->OpenURL( | 221 browser->OpenURL( |
222 content::OpenURLParams(match.destination_url, | 222 content::OpenURLParams(match.destination_url, |
223 content::Referrer(), | 223 content::Referrer(), |
224 disposition, | 224 disposition, |
225 match.transition, | 225 match.transition, |
226 false)); | 226 false)); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 void SearchBuilder::OnResultChanged(bool default_match_changed) { | 230 void SearchBuilder::OnResultChanged(bool default_match_changed) { |
231 // TODO(xiyuan): Handle default match properly. | 231 // TODO(xiyuan): Handle default match properly. |
232 const AutocompleteResult& ac_result = controller_->result(); | 232 const AutocompleteResult& ac_result = controller_->result(); |
233 results_->DeleteAll(); | 233 results_->DeleteAll(); |
234 for (ACMatches::const_iterator it = ac_result.begin(); | 234 for (ACMatches::const_iterator it = ac_result.begin(); |
235 it != ac_result.end(); | 235 it != ac_result.end(); |
236 ++it) { | 236 ++it) { |
237 results_->Add(new SearchBuilderResult(profile_, *it)); | 237 results_->Add(new SearchBuilderResult(profile_, *it)); |
238 } | 238 } |
239 } | 239 } |
OLD | NEW |