Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 222923007: Implement SearchTabHelperDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "build/build_config.h"
14 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/history/most_visited_tiles_experiment.h"
16 #include "chrome/browser/history/top_sites.h"
17 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search/instant_service.h" 15 #include "chrome/browser/search/instant_service.h"
19 #include "chrome/browser/search/instant_service_factory.h" 16 #include "chrome/browser/search/instant_service_factory.h"
20 #include "chrome/browser/search/search.h" 17 #include "chrome/browser/search/search.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/ui/app_list/app_list_util.h" 19 #include "chrome/browser/ui/app_list/app_list_util.h"
23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_finder.h"
25 #include "chrome/browser/ui/browser_navigator.h" 20 #include "chrome/browser/ui/browser_navigator.h"
26 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
27 #include "chrome/browser/ui/omnibox/location_bar.h" 22 #include "chrome/browser/ui/omnibox/location_bar.h"
28 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 23 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
29 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 24 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
30 #include "chrome/browser/ui/omnibox/omnibox_view.h" 25 #include "chrome/browser/ui/omnibox/omnibox_view.h"
31 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" 26 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h"
27 #include "chrome/browser/ui/search/search_tab_helper_delegate.h"
32 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 28 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
35 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" 29 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
36 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
37 #include "components/signin/core/browser/signin_manager.h" 31 #include "components/signin/core/browser/signin_manager.h"
38 #include "content/public/browser/navigation_controller.h" 32 #include "content/public/browser/navigation_controller.h"
39 #include "content/public/browser/navigation_details.h" 33 #include "content/public/browser/navigation_details.h"
40 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
41 #include "content/public/browser/navigation_type.h" 35 #include "content/public/browser/navigation_type.h"
42 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
44 #include "content/public/browser/render_process_host.h" 38 #include "content/public/browser/render_process_host.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (!profile || !contents) 100 if (!profile || !contents)
107 return false; 101 return false;
108 102
109 InstantService* instant_service = 103 InstantService* instant_service =
110 InstantServiceFactory::GetForProfile(profile); 104 InstantServiceFactory::GetForProfile(profile);
111 return instant_service && 105 return instant_service &&
112 instant_service->IsInstantProcess( 106 instant_service->IsInstantProcess(
113 contents->GetRenderProcessHost()->GetID()); 107 contents->GetRenderProcessHost()->GetID());
114 } 108 }
115 109
116 // Updates the location bar to reflect |contents| Instant support state.
117 void UpdateLocationBar(content::WebContents* contents) {
118 // iOS and Android don't use the Instant framework.
119 #if !defined(OS_IOS) && !defined(OS_ANDROID)
120 if (!contents)
121 return;
122
123 Browser* browser = chrome::FindBrowserWithWebContents(contents);
124 if (!browser)
125 return;
126 browser->OnWebContentsInstantSupportDisabled(contents);
127 #endif
128 }
129
130 // Called when an NTP finishes loading. If the load start time was noted, 110 // Called when an NTP finishes loading. If the load start time was noted,
131 // calculates and logs the total load time. 111 // calculates and logs the total load time.
132 void RecordNewTabLoadTime(content::WebContents* contents) { 112 void RecordNewTabLoadTime(content::WebContents* contents) {
133 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents); 113 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents);
134 if (core_tab_helper->new_tab_start_time().is_null()) 114 if (core_tab_helper->new_tab_start_time().is_null())
135 return; 115 return;
136 116
137 base::TimeDelta duration = 117 base::TimeDelta duration =
138 base::TimeTicks::Now() - core_tab_helper->new_tab_start_time(); 118 base::TimeTicks::Now() - core_tab_helper->new_tab_start_time();
139 UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration); 119 UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration);
140 core_tab_helper->set_new_tab_start_time(base::TimeTicks()); 120 core_tab_helper->set_new_tab_start_time(base::TimeTicks());
141 } 121 }
142 122
143 // Returns the OmniboxView for |contents| or NULL if not available.
144 OmniboxView* GetOmniboxView(content::WebContents* contents) {
145 // iOS and Android don't use the Instant framework.
146 #if defined(OS_IOS) || defined(OS_ANDROID)
147 return NULL;
148 #else
149 if (!contents)
150 return NULL;
151 Browser* browser = chrome::FindBrowserWithWebContents(contents);
152 return browser ? browser->window()->GetLocationBar()->GetOmniboxView() : NULL;
153 #endif
154 }
155
156 } // namespace 123 } // namespace
157 124
158 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) 125 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
159 : WebContentsObserver(web_contents), 126 : WebContentsObserver(web_contents),
160 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), 127 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()),
161 web_contents_(web_contents), 128 web_contents_(web_contents),
162 ipc_router_(web_contents, this, 129 ipc_router_(web_contents, this,
163 make_scoped_ptr(new SearchIPCRouterPolicyImpl(web_contents)) 130 make_scoped_ptr(new SearchIPCRouterPolicyImpl(web_contents))
164 .PassAs<SearchIPCRouter::Policy>()), 131 .PassAs<SearchIPCRouter::Policy>()),
165 instant_service_(NULL) { 132 instant_service_(NULL),
133 delegate_(NULL) {
166 if (!is_search_enabled_) 134 if (!is_search_enabled_)
167 return; 135 return;
168 136
169 instant_service_ = 137 instant_service_ =
170 InstantServiceFactory::GetForProfile( 138 InstantServiceFactory::GetForProfile(
171 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); 139 Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
172 if (instant_service_) 140 if (instant_service_)
173 instant_service_->AddObserver(this); 141 instant_service_->AddObserver(this);
174 } 142 }
175 143
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 187
220 InstantSupportState new_state = instant_support ? INSTANT_SUPPORT_YES : 188 InstantSupportState new_state = instant_support ? INSTANT_SUPPORT_YES :
221 INSTANT_SUPPORT_NO; 189 INSTANT_SUPPORT_NO;
222 190
223 model_.SetInstantSupportState(new_state); 191 model_.SetInstantSupportState(new_state);
224 192
225 content::NavigationEntry* entry = 193 content::NavigationEntry* entry =
226 web_contents_->GetController().GetVisibleEntry(); 194 web_contents_->GetController().GetVisibleEntry();
227 if (entry) { 195 if (entry) {
228 chrome::SetInstantSupportStateInNavigationEntry(new_state, entry); 196 chrome::SetInstantSupportStateInNavigationEntry(new_state, entry);
229 if (!instant_support) 197 if (delegate_ && !instant_support)
230 UpdateLocationBar(web_contents_); 198 delegate_->OnWebContentsInstantSupportDisabled(web_contents_);
231 } 199 }
232 } 200 }
233 201
234 bool SearchTabHelper::SupportsInstant() const { 202 bool SearchTabHelper::SupportsInstant() const {
235 return model_.instant_support() == INSTANT_SUPPORT_YES; 203 return model_.instant_support() == INSTANT_SUPPORT_YES;
236 } 204 }
237 205
238 void SearchTabHelper::SetSuggestionToPrefetch( 206 void SearchTabHelper::SetSuggestionToPrefetch(
239 const InstantSuggestion& suggestion) { 207 const InstantSuggestion& suggestion) {
240 ipc_router_.SetSuggestionToPrefetch(suggestion); 208 ipc_router_.SetSuggestionToPrefetch(suggestion);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // crbug.com/251330 for more details. 343 // crbug.com/251330 for more details.
376 if (load_details.is_in_page || 344 if (load_details.is_in_page ||
377 load_details.type == content::NAVIGATION_TYPE_IN_PAGE) { 345 load_details.type == content::NAVIGATION_TYPE_IN_PAGE) {
378 // When an "in-page" navigation happens, we will not receive a 346 // When an "in-page" navigation happens, we will not receive a
379 // DidFinishLoad() event. Therefore, we will not determine the Instant 347 // DidFinishLoad() event. Therefore, we will not determine the Instant
380 // support for the navigated page. So, copy over the Instant support from 348 // support for the navigated page. So, copy over the Instant support from
381 // the previous entry. If the page does not support Instant, update the 349 // the previous entry. If the page does not support Instant, update the
382 // location bar from here to turn off search terms replacement. 350 // location bar from here to turn off search terms replacement.
383 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(), 351 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(),
384 entry); 352 entry);
385 if (model_.instant_support() == INSTANT_SUPPORT_NO) 353 if (delegate_ && model_.instant_support() == INSTANT_SUPPORT_NO)
386 UpdateLocationBar(web_contents_); 354 delegate_->OnWebContentsInstantSupportDisabled(web_contents_);
387 return; 355 return;
388 } 356 }
389 357
390 model_.SetInstantSupportState(INSTANT_SUPPORT_UNKNOWN); 358 model_.SetInstantSupportState(INSTANT_SUPPORT_UNKNOWN);
391 model_.SetVoiceSearchSupported(false); 359 model_.SetVoiceSearchSupported(false);
392 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(), 360 chrome::SetInstantSupportStateInNavigationEntry(model_.instant_support(),
393 entry); 361 entry);
394 } 362 }
395 363
396 void SearchTabHelper::OnInstantSupportDetermined(bool supports_instant) { 364 void SearchTabHelper::OnInstantSupportDetermined(bool supports_instant) {
397 InstantSupportChanged(supports_instant); 365 InstantSupportChanged(supports_instant);
398 } 366 }
399 367
400 void SearchTabHelper::OnSetVoiceSearchSupport(bool supports_voice_search) { 368 void SearchTabHelper::OnSetVoiceSearchSupport(bool supports_voice_search) {
401 model_.SetVoiceSearchSupported(supports_voice_search); 369 model_.SetVoiceSearchSupported(supports_voice_search);
402 } 370 }
403 371
404 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { 372 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) {
405 ipc_router_.SendThemeBackgroundInfo(theme_info); 373 ipc_router_.SendThemeBackgroundInfo(theme_info);
406 } 374 }
407 375
408 void SearchTabHelper::MostVisitedItemsChanged( 376 void SearchTabHelper::MostVisitedItemsChanged(
409 const std::vector<InstantMostVisitedItem>& items) { 377 const std::vector<InstantMostVisitedItem>& items) {
410 std::vector<InstantMostVisitedItem> items_copy(items); 378 std::vector<InstantMostVisitedItem> items_copy(items);
411 MaybeRemoveMostVisitedItems(&items_copy); 379 if (delegate_)
380 delegate_->RemoveMostVisitedItemsMatchingOpenTabs(&items_copy);
381
412 ipc_router_.SendMostVisitedItems(items_copy); 382 ipc_router_.SendMostVisitedItems(items_copy);
413 } 383 }
414 384
415 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) { 385 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) {
416 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin); 386 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin);
417 } 387 }
418 388
419 void SearchTabHelper::MaybeRemoveMostVisitedItems(
420 std::vector<InstantMostVisitedItem>* items) {
421 // The code below uses APIs not available on Android and the experiment should
422 // not run there.
423 #if !defined(OS_ANDROID)
424 if (!history::MostVisitedTilesExperiment::IsDontShowOpenURLsEnabled())
425 return;
426
427 Profile* profile =
428 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
429 if (!profile)
430 return;
431
432 Browser* browser = chrome::FindBrowserWithProfile(profile,
433 chrome::GetActiveDesktop());
434 if (!browser)
435 return;
436
437 TabStripModel* tab_strip_model = browser->tab_strip_model();
438 history::TopSites* top_sites = profile->GetTopSites();
439 if (!tab_strip_model || !top_sites) {
440 NOTREACHED();
441 return;
442 }
443
444 std::set<std::string> open_urls;
445 chrome::GetOpenUrls(*tab_strip_model, *top_sites, &open_urls);
446 history::MostVisitedTilesExperiment::RemoveItemsMatchingOpenTabs(
447 open_urls, items);
448 #endif
449 }
450
451 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) { 389 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
452 OmniboxView* omnibox = GetOmniboxView(web_contents()); 390 OmniboxView* omnibox = delegate_ ? delegate_->GetOmniboxView() : NULL;
453 if (!omnibox) 391 if (!omnibox)
454 return; 392 return;
455 393
456 // Do not add a default case in the switch block for the following reasons: 394 // Do not add a default case in the switch block for the following reasons:
457 // (1) Explicitly handle the new states. If new states are added in the 395 // (1) Explicitly handle the new states. If new states are added in the
458 // OmniboxFocusState, the compiler will warn the developer to handle the new 396 // OmniboxFocusState, the compiler will warn the developer to handle the new
459 // states. 397 // states.
460 // (2) An attacker may control the renderer and sends the browser process a 398 // (2) An attacker may control the renderer and sends the browser process a
461 // malformed IPC. This function responds to the invalid |state| values by 399 // malformed IPC. This function responds to the invalid |state| values by
462 // doing nothing instead of crashing the browser process (intentional no-op). 400 // doing nothing instead of crashing the browser process (intentional no-op).
(...skipping 19 matching lines...) Expand all
482 // interaction. 420 // interaction.
483 if (!omnibox->model()->popup_model()->IsOpen()) 421 if (!omnibox->model()->popup_model()->IsOpen())
484 web_contents()->GetView()->Focus(); 422 web_contents()->GetView()->Focus();
485 break; 423 break;
486 } 424 }
487 } 425 }
488 426
489 void SearchTabHelper::NavigateToURL(const GURL& url, 427 void SearchTabHelper::NavigateToURL(const GURL& url,
490 WindowOpenDisposition disposition, 428 WindowOpenDisposition disposition,
491 bool is_most_visited_item_url) { 429 bool is_most_visited_item_url) {
492 // iOS and Android don't use the Instant framework.
493 #if !defined(OS_IOS) && !defined(OS_ANDROID)
494 // TODO(kmadhusu): Remove chrome::FindBrowser...() function call from here.
495 // Create a SearchTabHelperDelegate interface and have the Browser object
496 // implement that interface to provide the necessary functionality.
497 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
498 Profile* profile =
499 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
500 if (!browser || !profile)
501 return;
502
503 if (is_most_visited_item_url) { 430 if (is_most_visited_item_url) {
504 content::RecordAction( 431 content::RecordAction(
505 base::UserMetricsAction("InstantExtended.MostVisitedClicked")); 432 base::UserMetricsAction("InstantExtended.MostVisitedClicked"));
506 } 433 }
507 434
508 chrome::NavigateParams params(browser, url, 435 if (delegate_)
509 content::PAGE_TRANSITION_AUTO_BOOKMARK); 436 delegate_->NavigateToURL(url, disposition, web_contents_);
510 params.referrer = content::Referrer();
511 params.source_contents = web_contents_;
512 params.disposition = disposition;
513 params.is_renderer_initiated = false;
514 params.initiating_profile = profile;
515 chrome::Navigate(&params);
516 #endif
517 } 437 }
518 438
519 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { 439 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) {
520 DCHECK(!url.is_empty()); 440 DCHECK(!url.is_empty());
521 if (instant_service_) 441 if (instant_service_)
522 instant_service_->DeleteMostVisitedItem(url); 442 instant_service_->DeleteMostVisitedItem(url);
523 } 443 }
524 444
525 void SearchTabHelper::OnUndoMostVisitedDeletion(const GURL& url) { 445 void SearchTabHelper::OnUndoMostVisitedDeletion(const GURL& url) {
526 DCHECK(!url.is_empty()); 446 DCHECK(!url.is_empty());
(...skipping 17 matching lines...) Expand all
544 web_contents())->LogMostVisitedImpression(position, provider); 464 web_contents())->LogMostVisitedImpression(position, provider);
545 } 465 }
546 466
547 void SearchTabHelper::OnLogMostVisitedNavigation( 467 void SearchTabHelper::OnLogMostVisitedNavigation(
548 int position, const base::string16& provider) { 468 int position, const base::string16& provider) {
549 NTPUserDataLogger::GetOrCreateFromWebContents( 469 NTPUserDataLogger::GetOrCreateFromWebContents(
550 web_contents())->LogMostVisitedNavigation(position, provider); 470 web_contents())->LogMostVisitedNavigation(position, provider);
551 } 471 }
552 472
553 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) { 473 void SearchTabHelper::PasteIntoOmnibox(const base::string16& text) {
554 OmniboxView* omnibox = GetOmniboxView(web_contents()); 474 OmniboxView* omnibox = delegate_ ? delegate_->GetOmniboxView() : NULL;
555 if (!omnibox) 475 if (!omnibox)
556 return; 476 return;
557 477
558 // The first case is for right click to paste, where the text is retrieved 478 // The first case is for right click to paste, where the text is retrieved
559 // from the clipboard already sanitized. The second case is needed to handle 479 // from the clipboard already sanitized. The second case is needed to handle
560 // drag-and-drop value and it has to be sanitazed before setting it into the 480 // drag-and-drop value and it has to be sanitazed before setting it into the
561 // omnibox. 481 // omnibox.
562 base::string16 text_to_paste = text.empty() ? omnibox->GetClipboardText() : 482 base::string16 text_to_paste = text.empty() ? omnibox->GetClipboardText() :
563 omnibox->SanitizeTextForPaste(text); 483 omnibox->SanitizeTextForPaste(text);
564 484
(...skipping 25 matching lines...) Expand all
590 if (IsNTP(web_contents_) || is_preloaded_ntp) { 510 if (IsNTP(web_contents_) || is_preloaded_ntp) {
591 type = SearchMode::MODE_NTP; 511 type = SearchMode::MODE_NTP;
592 origin = SearchMode::ORIGIN_NTP; 512 origin = SearchMode::ORIGIN_NTP;
593 } else if (IsSearchResults(web_contents_)) { 513 } else if (IsSearchResults(web_contents_)) {
594 type = SearchMode::MODE_SEARCH_RESULTS; 514 type = SearchMode::MODE_SEARCH_RESULTS;
595 origin = SearchMode::ORIGIN_SEARCH; 515 origin = SearchMode::ORIGIN_SEARCH;
596 } 516 }
597 if (!update_origin) 517 if (!update_origin)
598 origin = model_.mode().origin; 518 origin = model_.mode().origin;
599 519
600 OmniboxView* omnibox = GetOmniboxView(web_contents()); 520 OmniboxView* omnibox = delegate_ ? delegate_->GetOmniboxView() : NULL;
Jered 2014/04/04 22:39:27 Extract a helper GetOmniboxView() and have it retu
kmadhusu 2014/04/07 21:44:15 Done.
601 if (omnibox && omnibox->model()->user_input_in_progress()) 521 if (omnibox && omnibox->model()->user_input_in_progress())
602 type = SearchMode::MODE_SEARCH_SUGGESTIONS; 522 type = SearchMode::MODE_SEARCH_SUGGESTIONS;
603 523
604 SearchMode old_mode(model_.mode()); 524 SearchMode old_mode(model_.mode());
605 model_.SetMode(SearchMode(type, origin)); 525 model_.SetMode(SearchMode(type, origin));
606 if (old_mode.is_ntp() != model_.mode().is_ntp()) { 526 if (old_mode.is_ntp() != model_.mode().is_ntp()) {
607 ipc_router_.SetInputInProgress(IsInputInProgress()); 527 ipc_router_.SetInputInProgress(IsInputInProgress());
608 } 528 }
609 } 529 }
610 530
(...skipping 21 matching lines...) Expand all
632 content::NavigationController::LoadURLParams load_params( 552 content::NavigationController::LoadURLParams load_params(
633 (GURL(chrome::kChromeSearchLocalNtpUrl))); 553 (GURL(chrome::kChromeSearchLocalNtpUrl)));
634 load_params.referrer = content::Referrer(); 554 load_params.referrer = content::Referrer();
635 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; 555 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT;
636 // Don't push a history entry. 556 // Don't push a history entry.
637 load_params.should_replace_current_entry = true; 557 load_params.should_replace_current_entry = true;
638 web_contents_->GetController().LoadURLWithParams(load_params); 558 web_contents_->GetController().LoadURLWithParams(load_params);
639 } 559 }
640 560
641 bool SearchTabHelper::IsInputInProgress() const { 561 bool SearchTabHelper::IsInputInProgress() const {
642 OmniboxView* omnibox = GetOmniboxView(web_contents()); 562 OmniboxView* omnibox = delegate_ ? delegate_->GetOmniboxView() : NULL;
643 return !model_.mode().is_ntp() && omnibox && 563 return !model_.mode().is_ntp() && omnibox &&
644 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 564 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
645 } 565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698