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

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

Issue 437803003: [Most Visited] Removing Most Visited Tiles experiment code, which is obsolete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 6 years, 4 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 "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/history/most_visited_tiles_experiment.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/search/instant_service.h" 15 #include "chrome/browser/search/instant_service.h"
17 #include "chrome/browser/search/instant_service_factory.h" 16 #include "chrome/browser/search/instant_service_factory.h"
18 #include "chrome/browser/search/search.h" 17 #include "chrome/browser/search/search.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/sync/profile_sync_service.h" 19 #include "chrome/browser/sync/profile_sync_service.h"
21 #include "chrome/browser/sync/profile_sync_service_factory.h" 20 #include "chrome/browser/sync/profile_sync_service_factory.h"
22 #include "chrome/browser/ui/app_list/app_list_util.h" 21 #include "chrome/browser/ui/app_list/app_list_util.h"
23 #include "chrome/browser/ui/browser_navigator.h" 22 #include "chrome/browser/ui/browser_navigator.h"
24 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 void SearchTabHelper::OnSetVoiceSearchSupport(bool supports_voice_search) { 411 void SearchTabHelper::OnSetVoiceSearchSupport(bool supports_voice_search) {
413 model_.SetVoiceSearchSupported(supports_voice_search); 412 model_.SetVoiceSearchSupported(supports_voice_search);
414 } 413 }
415 414
416 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { 415 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) {
417 ipc_router_.SendThemeBackgroundInfo(theme_info); 416 ipc_router_.SendThemeBackgroundInfo(theme_info);
418 } 417 }
419 418
420 void SearchTabHelper::MostVisitedItemsChanged( 419 void SearchTabHelper::MostVisitedItemsChanged(
421 const std::vector<InstantMostVisitedItem>& items) { 420 const std::vector<InstantMostVisitedItem>& items) {
422 std::vector<InstantMostVisitedItem> items_copy(items); 421 ipc_router_.SendMostVisitedItems(items);
423 MaybeRemoveMostVisitedItems(&items_copy);
424 ipc_router_.SendMostVisitedItems(items_copy);
425 } 422 }
426 423
427 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) { 424 void SearchTabHelper::OmniboxStartMarginChanged(int omnibox_start_margin) {
428 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin); 425 ipc_router_.SetOmniboxStartMargin(omnibox_start_margin);
429 } 426 }
430 427
431 void SearchTabHelper::MaybeRemoveMostVisitedItems(
432 std::vector<InstantMostVisitedItem>* items) {
433 if (!delegate_)
434 return;
435
436 if (!history::MostVisitedTilesExperiment::IsDontShowOpenURLsEnabled())
437 return;
438
439 history::MostVisitedTilesExperiment::RemoveItemsMatchingOpenTabs(
440 delegate_->GetOpenUrls(), items);
441 }
442
443 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) { 428 void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
444 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef. 429 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
445 #if !defined(OS_ANDROID) 430 #if !defined(OS_ANDROID)
446 OmniboxView* omnibox = GetOmniboxView(); 431 OmniboxView* omnibox = GetOmniboxView();
447 if (!omnibox) 432 if (!omnibox)
448 return; 433 return;
449 434
450 // Do not add a default case in the switch block for the following reasons: 435 // Do not add a default case in the switch block for the following reasons:
451 // (1) Explicitly handle the new states. If new states are added in the 436 // (1) Explicitly handle the new states. If new states are added in the
452 // OmniboxFocusState, the compiler will warn the developer to handle the new 437 // OmniboxFocusState, the compiler will warn the developer to handle the new
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 616
632 bool SearchTabHelper::IsInputInProgress() const { 617 bool SearchTabHelper::IsInputInProgress() const {
633 OmniboxView* omnibox = GetOmniboxView(); 618 OmniboxView* omnibox = GetOmniboxView();
634 return !model_.mode().is_ntp() && omnibox && 619 return !model_.mode().is_ntp() && omnibox &&
635 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 620 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
636 } 621 }
637 622
638 OmniboxView* SearchTabHelper::GetOmniboxView() const { 623 OmniboxView* SearchTabHelper::GetOmniboxView() const {
639 return delegate_ ? delegate_->GetOmniboxView() : NULL; 624 return delegate_ ? delegate_->GetOmniboxView() : NULL;
640 } 625 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698