diff options
81 files changed, 228 insertions, 334 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index c379232..03a6e73 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -311,8 +311,8 @@ void SearchProvider::Start(const AutocompleteInput& input, // TODO(dcblack): Once we are done refactoring the omnibox so we don't need to // use FinalizeInstantQuery anymore, we can take out this check and remove // this provider from kInstantExtendedOmniboxProviders. - if (!chrome::search::IsInstantExtendedAPIEnabled() || - !chrome::search::IsInstantEnabled(profile_)) { + if (!chrome::IsInstantExtendedAPIEnabled() || + !chrome::IsInstantEnabled(profile_)) { DoHistoryQuery(minimal_changes); StartOrStopSuggestQuery(minimal_changes); } @@ -782,7 +782,7 @@ bool SearchProvider::ParseSuggestResults(Value* root_val, bool is_keyword) { extras->GetList("google:suggesttype", &types); // Only accept relevance suggestions if Instant is disabled. - if (!chrome::search::IsInstantEnabled(profile_)) { + if (!chrome::IsInstantEnabled(profile_)) { // Discard this list if its size does not match that of the suggestions. if (extras->GetList("google:suggestrelevance", &relevances) && relevances->GetSize() != results->GetSize()) @@ -1437,5 +1437,5 @@ void SearchProvider::UpdateDone() { // We're done when the timer isn't running, there are no suggest queries // pending, and we're not waiting on Instant. done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && - (instant_finalized_ || !chrome::search::IsInstantEnabled(profile_))); + (instant_finalized_ || !chrome::IsInstantEnabled(profile_))); } diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index 7a7d208..1893da5 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -273,7 +273,7 @@ void SearchProviderTest::QueryForInputAndSetWYTMatch( QueryForInput(text, false); profile_.BlockUntilHistoryProcessesPendingRequests(); ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery()); - EXPECT_NE(chrome::search::IsInstantEnabled(&profile_), provider_->done()); + EXPECT_NE(chrome::IsInstantEnabled(&profile_), provider_->done()); if (!wyt_match) return; ASSERT_GE(provider_->matches().size(), 1u); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index f3e632f..45b0879 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -427,7 +427,7 @@ int GetCrashSignalFD(const CommandLine& command_line) { // // If the input is already an effective URL then that same URL is returned. GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) { - CHECK(chrome::search::ShouldAssignURLToInstantRenderer(url, profile)) + CHECK(chrome::ShouldAssignURLToInstantRenderer(url, profile)) << "Error granting Instant access."; if (url.SchemeIs(chrome::kChromeSearchScheme)) @@ -711,7 +711,7 @@ GURL ChromeContentBrowserClient::GetEffectiveURL( // If the input |url| should be assigned to the Instant renderer, make its // effective URL distinct from other URLs on the search provider's domain. - if (chrome::search::ShouldAssignURLToInstantRenderer(url, profile)) + if (chrome::ShouldAssignURLToInstantRenderer(url, profile)) return GetEffectiveURLForInstant(url, profile); // If the input |url| should be assigned to the Signin renderer, make its @@ -755,7 +755,7 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite( if (!profile) return false; - if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile)) + if (chrome::ShouldAssignURLToInstantRenderer(effective_url, profile)) return true; if (SigninManager::IsWebBasedSigninFlowURL(effective_url)) @@ -836,7 +836,7 @@ bool ChromeContentBrowserClient::IsSuitableHost( InstantServiceFactory::GetForProfile(profile); if (instant_service && instant_service->IsInstantProcess(process_host->GetID())) - return chrome::search::ShouldAssignURLToInstantRenderer(site_url, profile); + return chrome::ShouldAssignURLToInstantRenderer(site_url, profile); SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile); if (signin_manager && signin_manager->IsSigninProcess(process_host->GetID())) @@ -930,7 +930,7 @@ void ChromeContentBrowserClient::SiteInstanceGotProcess( // Remember the ID of the Instant process to signal the renderer process // on startup in |AppendExtraCommandLineSwitches| below. - if (chrome::search::ShouldAssignURLToInstantRenderer( + if (chrome::ShouldAssignURLToInstantRenderer( site_instance->GetSiteURL(), profile)) { InstantService* instant_service = InstantServiceFactory::GetForProfile(profile); diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 8d17dcd..5265cd2 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -92,7 +92,7 @@ bool FaviconTabHelper::ShouldDisplayFavicon() { return true; // No favicon on Instant New Tab Pages. - if (chrome::search::IsInstantNTP(web_contents())) + if (chrome::IsInstantNTP(web_contents())) return false; content::WebUI* web_ui = web_contents()->GetWebUIForCurrentState(); diff --git a/chrome/browser/infobars/infobar_container.cc b/chrome/browser/infobars/infobar_container.cc index fab36bf..1829c9e 100644 --- a/chrome/browser/infobars/infobar_container.cc +++ b/chrome/browser/infobars/infobar_container.cc @@ -25,9 +25,8 @@ InfoBarContainer::Delegate::~Delegate() { } -InfoBarContainer::InfoBarContainer( - Delegate* delegate, - chrome::search::SearchModel* search_model) +InfoBarContainer::InfoBarContainer(Delegate* delegate, + SearchModel* search_model) : delegate_(delegate), infobar_service_(NULL), infobars_shown_(true), @@ -176,11 +175,9 @@ void InfoBarContainer::Observe(int type, } } -void InfoBarContainer::ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) { - if (!chrome::search::SearchModel::ShouldChangeTopBarsVisibility(old_state, - new_state)) +void InfoBarContainer::ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) { + if (!SearchModel::ShouldChangeTopBarsVisibility(old_state, new_state)) return; if (new_state.top_bars_visible && !infobars_shown_) { diff --git a/chrome/browser/infobars/infobar_container.h b/chrome/browser/infobars/infobar_container.h index da153a0ea..fa3d42c 100644 --- a/chrome/browser/infobars/infobar_container.h +++ b/chrome/browser/infobars/infobar_container.h @@ -18,12 +18,7 @@ class InfoBar; class InfoBarDelegate; class InfoBarService; - -namespace chrome { -namespace search { class SearchModel; -} -} // InfoBarContainer is a cross-platform base class to handle the visibility- // related aspects of InfoBars. While InfoBars own themselves, the @@ -35,7 +30,7 @@ class SearchModel; // // This class also observes changes to the SearchModel modes. It hides infobars // temporarily if the user changes into |SEARCH_SUGGESTIONS| mode (refer to -// chrome::search::Mode in chrome/common/search_types.h for all search modes) +// SearchMode in chrome/common/search_types.h for all search modes) // when on a : // - |DEFAULT| page: when Instant overlay is ready; // - |NTP| or |SEARCH_RESULTS| page: immediately; @@ -49,7 +44,7 @@ class SearchModel; // would re-show the infobars only to instantly animate them closed. The window // to re-hide infobars without animation is canceled if a tab change occurs. class InfoBarContainer : public content::NotificationObserver, - public chrome::search::SearchModelObserver { + public SearchModelObserver { public: class Delegate { public: @@ -70,8 +65,7 @@ class InfoBarContainer : public content::NotificationObserver, // |search_model| may be NULL if this class is used in a window that does not // support Instant Extended. - InfoBarContainer(Delegate* delegate, - chrome::search::SearchModel* search_model); + InfoBarContainer(Delegate* delegate, SearchModel* search_model); virtual ~InfoBarContainer(); // Changes the InfoBarService for which this container is showing @@ -129,10 +123,9 @@ class InfoBarContainer : public content::NotificationObserver, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // chrome::search::SearchModelObserver: - virtual void ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) OVERRIDE; + // SearchModelObserver: + virtual void ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) OVERRIDE; // Hides an InfoBar for the specified delegate, in response to a notification // from the selected InfoBarService. The InfoBar's disappearance will be @@ -174,7 +167,7 @@ class InfoBarContainer : public content::NotificationObserver, // Tracks which search mode is active, as well as mode changes, for Instant // Extended. - chrome::search::SearchModel* search_model_; + SearchModel* search_model_; // Calculated in SetMaxTopArrowHeight(). int top_arrow_target_height_; diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 3eac3cf..608baa9 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -820,7 +820,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ForceSafeSearch) { IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { MakeRequestFail make_request_fail("search.example"); - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); // Verifies that a default search is made using the provider configured via // policy. Also checks that default search can be completely disabled. diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 2dddab4..66d83ec 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -180,7 +180,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { apps::RegisterPrefs(registry); browser_shutdown::RegisterPrefs(registry); BrowserProcessImpl::RegisterPrefs(registry); - chrome::RegisterScreenshotPrefs(registry); + RegisterScreenshotPrefs(registry); ExternalProtocolHandler::RegisterPrefs(registry); FlagsUI::RegisterPrefs(registry); geolocation::RegisterPrefs(registry); @@ -267,7 +267,7 @@ void RegisterUserPrefs(PrefRegistrySyncable* registry) { BookmarkPromptPrefs::RegisterUserPrefs(registry); bookmark_utils::RegisterUserPrefs(registry); browser_sync::SyncPrefs::RegisterUserPrefs(registry); - chrome::search::RegisterUserPrefs(registry); + chrome::RegisterInstantUserPrefs(registry); ChromeContentBrowserClient::RegisterUserPrefs(registry); ChromeDownloadManagerDelegate::RegisterUserPrefs(registry); ChromeVersionService::RegisterUserPrefs(registry); diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index 0fb9bad..b8c16dc 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -24,7 +24,6 @@ #include "content/public/browser/web_contents.h" namespace chrome { -namespace search { namespace { @@ -322,7 +321,7 @@ bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) { IsInstantURL(url, profile)); } -void RegisterUserPrefs(PrefRegistrySyncable* registry) { +void RegisterInstantUserPrefs(PrefRegistrySyncable* registry) { registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kInstantEnabled, false, @@ -545,5 +544,4 @@ GURL CoerceCommandLineURLToTemplateURL(const GURL& instant_url, return instant_url.ReplaceComponents(replacements); } -} // namespace search } // namespace chrome diff --git a/chrome/browser/search/search.h b/chrome/browser/search/search.h index 4c2cbf2..ee9dfb62 100644 --- a/chrome/browser/search/search.h +++ b/chrome/browser/search/search.h @@ -24,7 +24,6 @@ class WebContents; } namespace chrome { -namespace search { // The key used to store search terms data in the NavigationEntry to be later // displayed in the omnibox. With the context of the user's exact query, @@ -74,7 +73,7 @@ bool NavEntryIsInstantNTP(const content::WebContents* contents, const content::NavigationEntry* nav_entry); // Registers Instant-related user preferences. Called at startup. -void RegisterUserPrefs(PrefRegistrySyncable* registry); +void RegisterInstantUserPrefs(PrefRegistrySyncable* registry); // Returns prefs::kInstantExtendedEnabled in extended mode; // prefs::kInstantEnabled otherwise. @@ -153,7 +152,6 @@ GURL CoerceCommandLineURLToTemplateURL(const GURL& instant_url, const TemplateURLRef& ref, int start_margin); -} // namespace search } // namespace chrome #endif // CHROME_BROWSER_SEARCH_SEARCH_H_ diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index f1d01c8..cd69741 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc @@ -16,7 +16,6 @@ #include "content/public/browser/web_contents.h" namespace chrome { -namespace search { TEST(EmbeddedSearchFieldTrialTest, GetFieldTrialInfo) { FieldTrialFlags flags; @@ -330,5 +329,4 @@ TEST_F(SearchTest, StartMarginCGI) { GetInstantURL(profile(), 10)); } -} // namespace search } // namespace chrome diff --git a/chrome/browser/search_engines/search_terms_data.cc b/chrome/browser/search_engines/search_terms_data.cc index ccbfb9c..4231f10 100644 --- a/chrome/browser/search_engines/search_terms_data.cc +++ b/chrome/browser/search_engines/search_terms_data.cc @@ -135,8 +135,8 @@ std::string UIThreadSearchTermsData::GetSearchClient() const { std::string UIThreadSearchTermsData::InstantEnabledParam() const { DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (chrome::search::IsInstantPrefEnabled(profile_) && - !chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantPrefEnabled(profile_) && + !chrome::IsInstantExtendedAPIEnabled()) return "ion=1&"; return std::string(); } @@ -145,7 +145,7 @@ std::string UIThreadSearchTermsData::InstantExtendedEnabledParam() const { DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::UI)); uint64 instant_extended_api_version = - chrome::search::EmbeddedSearchPageVersion(); + chrome::EmbeddedSearchPageVersion(); if (instant_extended_api_version) { return std::string(google_util::kInstantExtendedAPIParam) + "=" + base::Uint64ToString(instant_extended_api_version) + "&"; @@ -157,7 +157,7 @@ std::string UIThreadSearchTermsData::NTPIsThemedParam() const { DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::UI)); #if defined(ENABLE_THEMES) - if (!chrome::search::IsInstantExtendedAPIEnabled()) + if (!chrome::IsInstantExtendedAPIEnabled()) return std::string(); // TODO(dhollowa): Determine fraction of custom themes that don't affect the diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc index 9ba6551..3ab9fce 100644 --- a/chrome/browser/sessions/session_types.cc +++ b/chrome/browser/sessions/session_types.cc @@ -54,7 +54,7 @@ TabNavigation TabNavigation::FromNavigationEntry( // add support for persisting it. It is currently only used for layout tests. CHECK(entry.GetFrameToNavigate().empty()); navigation.search_terms_ = - chrome::search::GetSearchTermsFromNavigationEntry(&entry); + chrome::GetSearchTermsFromNavigationEntry(&entry); if (entry.GetFavicon().valid) navigation.favicon_url_ = entry.GetFavicon().url; @@ -346,8 +346,7 @@ scoped_ptr<NavigationEntry> TabNavigation::ToNavigationEntry( entry->SetOriginalRequestURL(original_request_url_); entry->SetIsOverridingUserAgent(is_overriding_user_agent_); entry->SetTimestamp(timestamp_); - entry->SetExtraData(chrome::search::kInstantExtendedSearchTermsKey, - search_terms_); + entry->SetExtraData(chrome::kInstantExtendedSearchTermsKey, search_terms_); return entry.Pass(); } diff --git a/chrome/browser/sessions/session_types_unittest.cc b/chrome/browser/sessions/session_types_unittest.cc index 98e50f4..465d917 100644 --- a/chrome/browser/sessions/session_types_unittest.cc +++ b/chrome/browser/sessions/session_types_unittest.cc @@ -65,7 +65,7 @@ scoped_ptr<content::NavigationEntry> MakeNavigationEntryForTest() { navigation_entry->SetIsOverridingUserAgent(kIsOverridingUserAgent); navigation_entry->SetTimestamp(kTimestamp); navigation_entry->SetExtraData( - chrome::search::kInstantExtendedSearchTermsKey, kSearchTerms); + chrome::kInstantExtendedSearchTermsKey, kSearchTerms); navigation_entry->GetFavicon().valid = true; navigation_entry->GetFavicon().url = kFaviconURL; return navigation_entry.Pass(); @@ -238,7 +238,7 @@ TEST(TabNavigationTest, ToNavigationEntry) { EXPECT_EQ(kIsOverridingUserAgent, new_navigation_entry->GetIsOverridingUserAgent()); EXPECT_EQ(kSearchTerms, - chrome::search::GetSearchTermsFromNavigationEntry( + chrome::GetSearchTermsFromNavigationEntry( new_navigation_entry.get())); } diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index c48b63e..cc02f5f 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -94,8 +94,7 @@ void BookmarkContextMenuController::BuildMenu() { AddSeparator(); AddItem(IDC_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER); - if (chrome::search::IsInstantExtendedAPIEnabled() && - !profile_->IsOffTheRecord()) { + if (chrome::IsInstantExtendedAPIEnabled() && !profile_->IsOffTheRecord()) { AddCheckboxItem(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT, IDS_BOOKMARK_BAR_SHOW_APPS_SHORTCUT); } diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc index d72b3b9..beef2f5 100644 --- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc +++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc @@ -37,7 +37,7 @@ bool IsInstantNTP(content::WebContents* web_contents) { web_contents->GetController().GetLastCommittedEntry(); if (!entry) entry = web_contents->GetController().GetVisibleEntry(); - return chrome::search::NavEntryIsInstantNTP(web_contents, entry); + return chrome::NavEntryIsInstantNTP(web_contents, entry); } } // namespace diff --git a/chrome/browser/ui/bookmarks/bookmark_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_unittest.cc index d54287a..da34d00 100644 --- a/chrome/browser/ui/bookmarks/bookmark_unittest.cc +++ b/chrome/browser/ui/bookmarks/bookmark_unittest.cc @@ -42,7 +42,7 @@ TEST_F(BookmarkTest, DetachedBookmarkBarOnCustomNTP) { class BookmarkInstantExtendedTest : public BrowserWithTestWindowTest { public: BookmarkInstantExtendedTest() { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); } protected: diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 523477f..bdf6a11 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -367,10 +367,9 @@ Browser::Browser(const CreateParams& params) tab_strip_model_->AddObserver(this); toolbar_model_.reset(new ToolbarModelImpl(toolbar_model_delegate_.get())); - search_model_.reset(new chrome::search::SearchModel()); + search_model_.reset(new SearchModel()); search_delegate_.reset( - new chrome::search::SearchDelegate(search_model_.get(), - toolbar_model_.get())); + new SearchDelegate(search_model_.get(), toolbar_model_.get())); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile_->GetOriginalProfile())); @@ -409,7 +408,7 @@ Browser::Browser(const CreateParams& params) profile_->GetPrefs()); if (is_type_tabbed()) - instant_controller_.reset(new chrome::BrowserInstantController(this)); + instant_controller_.reset(new BrowserInstantController(this)); UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); @@ -1401,7 +1400,7 @@ void Browser::BeforeUnloadFired(WebContents* web_contents, bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { const content::NavigationEntry* entry = source->GetController().GetActiveEntry(); - return chrome::search::NavEntryIsInstantNTP(source, entry); + return chrome::NavEntryIsInstantNTP(source, entry); } void Browser::SetFocusToLocationBar(bool select_all) { @@ -1809,13 +1808,10 @@ void Browser::Observe(int type, } } -void Browser::ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) { - if (chrome::search::SearchModel::ShouldChangeTopBarsVisibility(old_state, - new_state)) { +void Browser::ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) { + if (SearchModel::ShouldChangeTopBarsVisibility(old_state, new_state)) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); - } } /////////////////////////////////////////////////////////////////////////////// @@ -1839,7 +1835,7 @@ void Browser::UpdateToolbar(bool should_restore_state) { } void Browser::UpdateSearchState(WebContents* contents) { - if (chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantExtendedAPIEnabled()) search_delegate_->OnTabActivated(contents); } diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index d2c99df..95367ab 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -47,6 +47,7 @@ #include "ui/shell_dialogs/select_file_dialog.h" class BrowserContentSettingBubbleModelDelegate; +class BrowserInstantController; class BrowserSyncedWindowDelegate; class BrowserToolbarModelDelegate; class BrowserTabRestoreServiceDelegate; @@ -55,21 +56,18 @@ class FindBarController; class FullscreenController; class PrefService; class Profile; +class SearchDelegate; +class SearchModel; class StatusBubble; class TabNavigation; class TabStripModel; class TabStripModelDelegate; +struct SearchMode; struct WebApplicationInfo; namespace chrome { class BrowserCommandController; -class BrowserInstantController; class UnloadController; -namespace search { -struct Mode; -class SearchDelegate; -class SearchModel; -} } namespace content { @@ -103,7 +101,7 @@ class Browser : public TabStripModelObserver, public content::PageNavigator, public content::NotificationObserver, public ui::SelectFileDialog::Listener, - public chrome::search::SearchModelObserver { + public SearchModelObserver { public: // SessionService::WindowType mirrors these values. If you add to this // enum, look at SessionService::WindowType to see if it needs to be @@ -244,11 +242,11 @@ class Browser : public TabStripModelObserver, chrome::BrowserCommandController* command_controller() { return command_controller_.get(); } - chrome::search::SearchModel* search_model() { return search_model_.get(); } - const chrome::search::SearchModel* search_model() const { + SearchModel* search_model() { return search_model_.get(); } + const SearchModel* search_model() const { return search_model_.get(); } - chrome::search::SearchDelegate* search_delegate() { + SearchDelegate* search_delegate() { return search_delegate_.get(); } const SessionID& session_id() const { return session_id_; } @@ -262,7 +260,7 @@ class Browser : public TabStripModelObserver, BrowserSyncedWindowDelegate* synced_window_delegate() { return synced_window_delegate_.get(); } - chrome::BrowserInstantController* instant_controller() { + BrowserInstantController* instant_controller() { return instant_controller_.get(); } @@ -674,10 +672,9 @@ class Browser : public TabStripModelObserver, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // Overridden from chrome::search::SearchModelObserver: - virtual void ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) OVERRIDE; + // Overridden from SearchModelObserver: + virtual void ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) OVERRIDE; // Command and state updating /////////////////////////////////////////////// @@ -831,7 +828,7 @@ class Browser : public TabStripModelObserver, // When a new tab is activated its model state is propagated to this active // model. This way, observers only have to attach to this single model for // updates, and don't have to worry about active tab changes directly. - scoped_ptr<chrome::search::SearchModel> search_model_; + scoped_ptr<SearchModel> search_model_; // UI update coalescing and handling //////////////////////////////////////// @@ -899,7 +896,7 @@ class Browser : public TabStripModelObserver, // A delegate that handles the details of updating the "active" // |search_model_| state with the tab's state. - scoped_ptr<chrome::search::SearchDelegate> search_delegate_; + scoped_ptr<SearchDelegate> search_delegate_; // Helper which implements the TabRestoreServiceDelegate interface. scoped_ptr<BrowserTabRestoreServiceDelegate> tab_restore_service_delegate_; @@ -907,7 +904,7 @@ class Browser : public TabStripModelObserver, // Helper which implements the SyncedWindowDelegate interface. scoped_ptr<BrowserSyncedWindowDelegate> synced_window_delegate_; - scoped_ptr<chrome::BrowserInstantController> instant_controller_; + scoped_ptr<BrowserInstantController> instant_controller_; BookmarkBar::State bookmark_bar_state_; diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 0d34e6b..1117ae1 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -31,15 +31,13 @@ using content::UserMetricsAction; -namespace chrome { - //////////////////////////////////////////////////////////////////////////////// // BrowserInstantController, public: BrowserInstantController::BrowserInstantController(Browser* browser) : browser_(browser), instant_(ALLOW_THIS_IN_INITIALIZER_LIST(this), - chrome::search::IsInstantExtendedAPIEnabled()), + chrome::IsInstantExtendedAPIEnabled()), instant_unload_handler_(browser), initialized_theme_info_(false) { @@ -47,7 +45,7 @@ BrowserInstantController::BrowserInstantController(Browser* browser) // preference's default value is set to the existing value of kInstantEnabled. // Because this requires reading the value of the kInstantEnabled value, we // reset the default for kInstantExtendedEnabled here. - chrome::search::SetInstantExtendedPrefDefault(profile()); + chrome::SetInstantExtendedPrefDefault(profile()); profile_pref_registrar_.Init(profile()->GetPrefs()); profile_pref_registrar_.Add( @@ -227,9 +225,9 @@ void BrowserInstantController::ResetInstant(const std::string& pref_name) { // Update the default value of the kInstantExtendedEnabled pref to match the // value of the kInstantEnabled pref, if necessary. if (pref_name == prefs::kInstantEnabled) - chrome::search::SetInstantExtendedPrefDefault(profile()); + chrome::SetInstantExtendedPrefDefault(profile()); - bool instant_pref_enabled = chrome::search::IsInstantPrefEnabled(profile()); + bool instant_pref_enabled = chrome::IsInstantPrefEnabled(profile()); bool use_local_overlay_only = profile()->IsOffTheRecord() || (!instant_pref_enabled && !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)); @@ -237,17 +235,17 @@ void BrowserInstantController::ResetInstant(const std::string& pref_name) { } //////////////////////////////////////////////////////////////////////////////// -// BrowserInstantController, search::SearchModelObserver implementation: +// BrowserInstantController, SearchModelObserver implementation: void BrowserInstantController::ModelChanged( - const search::SearchModel::State& old_state, - const search::SearchModel::State& new_state) { + const SearchModel::State& old_state, + const SearchModel::State& new_state) { if (old_state.mode == new_state.mode) return; - const search::Mode& new_mode = new_state.mode; + const SearchMode& new_mode = new_state.mode; - if (search::IsInstantExtendedAPIEnabled()) { + if (chrome::IsInstantExtendedAPIEnabled()) { // Record some actions corresponding to the mode change. Note that to get // the full story, it's necessary to look at other UMA actions as well, // such as tab switches. @@ -353,5 +351,3 @@ void BrowserInstantController::OnThemeChanged(ThemeService* theme_service) { if (browser_->search_model()->mode().is_ntp()) instant_.ThemeChanged(theme_info_); } - -} // namespace chrome diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h index c84e4dc..9e8bc4a 100644 --- a/chrome/browser/ui/browser_instant_controller.h +++ b/chrome/browser/ui/browser_instant_controller.h @@ -30,10 +30,8 @@ namespace gfx { class Rect; } -namespace chrome { - class BrowserInstantController : public content::NotificationObserver, - public search::SearchModelObserver { + public SearchModelObserver { public: explicit BrowserInstantController(Browser* browser); virtual ~BrowserInstantController(); @@ -111,9 +109,8 @@ class BrowserInstantController : public content::NotificationObserver, void ResetInstant(const std::string& pref_name); // Overridden from search::SearchModelObserver: - virtual void ModelChanged( - const search::SearchModel::State& old_state, - const search::SearchModel::State& new_state) OVERRIDE; + virtual void ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) OVERRIDE; // content::NotificationObserver implementation. virtual void Observe(int type, @@ -144,6 +141,4 @@ class BrowserInstantController : public content::NotificationObserver, DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); }; -} // namespace chrome - #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 05eb9d8..fb73fe7 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -359,8 +359,7 @@ bool SwapInPrerender(WebContents* target_contents, const GURL& url) { bool SwapInInstantNTP(chrome::NavigateParams* params, const GURL& url, content::WebContents* source_contents) { - chrome::BrowserInstantController* instant = - params->browser->instant_controller(); + BrowserInstantController* instant = params->browser->instant_controller(); return instant && instant->MaybeSwapInInstantNTPContents( url, source_contents, ¶ms->target_contents); } diff --git a/chrome/browser/ui/browser_tab_contents.cc b/chrome/browser/ui/browser_tab_contents.cc index fad09c1..28b06f4 100644 --- a/chrome/browser/ui/browser_tab_contents.cc +++ b/chrome/browser/ui/browser_tab_contents.cc @@ -143,7 +143,7 @@ void BrowserTabContents::AttachTabHelpers(WebContents* web_contents) { SadTabHelper::CreateForWebContents(web_contents); safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(web_contents); SearchEngineTabHelper::CreateForWebContents(web_contents); - chrome::search::SearchTabHelper::CreateForWebContents(web_contents); + SearchTabHelper::CreateForWebContents(web_contents); SSLTabHelper::CreateForWebContents(web_contents); TabContentsSyncedTabDelegate::CreateForWebContents(web_contents); TabSpecificContentSettings::CreateForWebContents(web_contents); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index 9a9f4a7..aed025b 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -476,7 +476,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { // Add padding to the detached bookmark bar. // The state of our morph (if any); 1 is total bubble, 0 is the regular bar. CGFloat morph = [self detachedMorphProgress]; - CGFloat padding = chrome::search::IsInstantExtendedAPIEnabled() + CGFloat padding = chrome::IsInstantExtendedAPIEnabled() ? bookmarks::kSearchNTPBookmarkBarPadding : bookmarks::kNTPBookmarkBarPadding; buttonViewFrame = @@ -909,7 +909,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { [[self backgroundGradientView] setShowsDivider:YES]; [[self view] setHidden:NO]; AnimatableView* view = [self animatableView]; - CGFloat newHeight = chrome::search::IsInstantExtendedAPIEnabled() + CGFloat newHeight = chrome::IsInstantExtendedAPIEnabled() ? bookmarks::kSearchNewTabBookmarkBarHeight : chrome::kNTPBookmarkBarHeight; [view animateToNewHeight:newHeight @@ -956,7 +956,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { case BookmarkBar::SHOW: return bookmarks::kBookmarkBarHeight; case BookmarkBar::DETACHED: - if (chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantExtendedAPIEnabled()) return bookmarks::kSearchNewTabBookmarkBarHeight; return chrome::kNTPBookmarkBarHeight; case BookmarkBar::HIDDEN: @@ -1160,7 +1160,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { return NO; BOOL visible = bookmarkModel_->IsLoaded() && - chrome::search::IsInstantExtendedAPIEnabled() && + chrome::IsInstantExtendedAPIEnabled() && browser_->profile()->GetPrefs()->GetBoolean( prefs::kShowAppsShortcutInBookmarkBar) && !browser_->profile()->IsOffTheRecord(); diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm index b2c3dfb..ac78133 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm @@ -43,7 +43,7 @@ const CGFloat kBorderRadius = 3.0; if ([controller_ isInState:BookmarkBar::DETACHED] || [controller_ isAnimatingToState:BookmarkBar::DETACHED] || [controller_ isAnimatingFromState:BookmarkBar::DETACHED]) { - if (chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantExtendedAPIEnabled()) [self drawAsDetachedInstantExtendedUI]; else [self drawAsDetachedBubble]; @@ -158,7 +158,7 @@ const CGFloat kBorderRadius = 3.0; // Overlay with a ligher background color. NSColor* toolbarColor = gfx::SkColorToCalibratedNSColor( - chrome::search::GetDetachedBookmarkBarBackgroundColor(themeProvider)); + chrome::GetDetachedBookmarkBarBackgroundColor(themeProvider)); CGFloat alpha = morph * [toolbarColor alphaComponent]; [[toolbarColor colorWithAlphaComponent:alpha] set]; NSRectFillUsingOperation(bounds, NSCompositeSourceOver); @@ -177,7 +177,7 @@ const CGFloat kBorderRadius = 3.0; // Bottom stroke. NSColor* strokeColor = gfx::SkColorToCalibratedNSColor( - chrome::search::GetDetachedBookmarkBarSeparatorColor(themeProvider)); + chrome::GetDetachedBookmarkBarSeparatorColor(themeProvider)); strokeColor = [[self strokeColor] blendedColorWithFraction:morph ofColor:strokeColor]; strokeColor = [strokeColor colorWithAlphaComponent:0.5]; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index ca78ba4..6facc6d 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -32,7 +32,7 @@ class Extension; class BrowserWindowCocoa : public BrowserWindow, public extensions::ExtensionKeybindingRegistry::Delegate, - public chrome::search::SearchModelObserver { + public SearchModelObserver { public: BrowserWindowCocoa(Browser* browser, BrowserWindowController* controller); @@ -146,10 +146,9 @@ class BrowserWindowCocoa : virtual extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() OVERRIDE; - // Overridden from chrome::search::SearchModelObserver: - virtual void ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) OVERRIDE; + // Overridden from SearchModelObserver: + virtual void ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) OVERRIDE; // Adds the given FindBar cocoa controller to this browser window. void AddFindBar(FindBarCocoaController* find_bar_cocoa_controller); diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 1a4fcb2..b427fc0 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -657,9 +657,8 @@ extensions::ActiveTabPermissionGranter* return tab_helper ? tab_helper->active_tab_permission_granter() : NULL; } -void BrowserWindowCocoa::ModelChanged( - const chrome::search::SearchModel::State& old_state, - const chrome::search::SearchModel::State& new_state) { +void BrowserWindowCocoa::ModelChanged(const SearchModel::State& old_state, + const SearchModel::State& new_state) { [controller_ updateBookmarkBarStateForInstantOverlay]; } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 40d228e..d34267a 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -1917,8 +1917,7 @@ willAnimateFromState:(BookmarkBar::State)oldState } - (void)commitInstant { - if (chrome::BrowserInstantController* controller = - browser_->instant_controller()) + if (BrowserInstantController* controller = browser_->instant_controller()) controller->instant()->CommitIfPossible(INSTANT_COMMIT_FOCUS_LOST); } diff --git a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm index 2702cb9..1570f56 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm @@ -98,9 +98,9 @@ class BrowserWindowControllerTest : public InProcessBrowserTest { } void ShowInstantResults() { - chrome::search::EnableInstantExtendedAPIForTesting(); - chrome::search::Mode mode(chrome::search::Mode::MODE_SEARCH_SUGGESTIONS, - chrome::search::Mode::ORIGIN_SEARCH); + chrome::EnableInstantExtendedAPIForTesting(); + SearchMode mode(SearchMode::MODE_SEARCH_SUGGESTIONS, + SearchMode::ORIGIN_SEARCH); browser()->search_model()->SetMode(mode); browser()->search_model()->SetTopBarsVisible(false); EXPECT_TRUE(browser()->search_model()->mode().is_search_suggestions()); @@ -109,9 +109,8 @@ class BrowserWindowControllerTest : public InProcessBrowserTest { } void ShowInstantNTP() { - chrome::search::EnableInstantExtendedAPIForTesting(); - chrome::search::Mode mode(chrome::search::Mode::MODE_NTP, - chrome::search::Mode::ORIGIN_NTP); + chrome::EnableInstantExtendedAPIForTesting(); + SearchMode mode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP); browser()->search_model()->SetMode(mode); browser()->search_model()->SetTopBarsVisible(true); EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm index fcb2806..0244c3d 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm @@ -284,7 +284,7 @@ NSAttributedString* OmniboxPopupViewMac::MatchText( OmniboxPopupView* OmniboxPopupViewMac::Create(OmniboxView* omnibox_view, OmniboxEditModel* edit_model, NSTextField* field) { - if (chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantExtendedAPIEnabled()) return new OmniboxPopupNonView(edit_model); return new OmniboxPopupViewMac(omnibox_view, edit_model, field); } diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm index c3a41a2..7c43e06 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm @@ -673,7 +673,7 @@ bool OmniboxViewMac::OnDoCommandBySelector(SEL cmd) { if (model()->popup_model()->IsOpen()) { // If instant extended is enabled then allow users to press tab to select // results from the omnibox popup. - BOOL enableTabAutocomplete = chrome::search::IsInstantExtendedAPIEnabled(); + BOOL enableTabAutocomplete = chrome::IsInstantExtendedAPIEnabled(); if (cmd == @selector(insertBacktab:)) { if (model()->popup_model()->selected_line_state() == diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm index 238d6e2..134a7ff 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm @@ -115,7 +115,7 @@ TEST_F(OmniboxViewMacTest, GetFieldFont) { } TEST_F(OmniboxViewMacTest, TabToAutocomplete) { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); OmniboxViewMac view(NULL, NULL, profile(), NULL, NULL); // This is deleted by the omnibox view. diff --git a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm index 0d52d94..271ca06 100644 --- a/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm +++ b/chrome/browser/ui/cocoa/tab_contents/instant_overlay_controller_mac.mm @@ -28,7 +28,7 @@ InstantOverlayControllerMac::~InstantOverlayControllerMac() { void InstantOverlayControllerMac::OverlayStateChanged( const InstantOverlayModel& model) { - bool set_top_bars_visibility = chrome::search::IsInstantExtendedAPIEnabled(); + bool set_top_bars_visibility = chrome::IsInstantExtendedAPIEnabled(); if (model.mode().is_ntp() || model.mode().is_search_suggestions()) { // Drop shadow is only needed if search mode is not |NTP| and overlay does @@ -53,9 +53,8 @@ void InstantOverlayControllerMac::OverlayStateChanged( // Set top bars (bookmark and info bars) visibility for current tab via // |SearchTabHelper| of current active web contents: top bars are hidden if // there's overlay. - chrome::search::SearchTabHelper* search_tab_helper = - chrome::search::SearchTabHelper::FromWebContents( - browser_->tab_strip_model()->GetActiveWebContents()); + SearchTabHelper* search_tab_helper = SearchTabHelper::FromWebContents( + browser_->tab_strip_model()->GetActiveWebContents()); if (search_tab_helper) { search_tab_helper->model()->SetTopBarsVisible( ![overlay_ isShowingOverlay]); diff --git a/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller_browsertest.mm b/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller_browsertest.mm index 049d61c..3ea5f68 100644 --- a/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller_browsertest.mm @@ -81,8 +81,8 @@ class OverlayableContentsControllerTest : public InProcessBrowserTest, // Verify that the view is correctly laid out when size is specified in percent. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePerecent) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_NTP; + SearchMode mode; + mode.mode = SearchMode::MODE_NTP; CGFloat expected_height = 30; InstantSizeUnits units = INSTANT_SIZE_PERCENT; instant_overlay_model_.SetOverlayState(mode, expected_height, units); @@ -98,8 +98,8 @@ IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePerecent) { // Verify that the view is correctly laid out when size is specified in pixels. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePixels) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_NTP; + SearchMode mode; + mode.mode = SearchMode::MODE_NTP; CGFloat expected_height = 30; InstantSizeUnits units = INSTANT_SIZE_PIXELS; instant_overlay_model_.SetOverlayState(mode, expected_height, units); @@ -116,13 +116,13 @@ IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, SizePixels) { // Verify that a shadow is not shown when the overlay covers the entire page // or when the overlay is in NTP mode. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, NoShadowFullHeight) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; + SearchMode mode; + mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; instant_overlay_model_.SetOverlayState(mode, 100, INSTANT_SIZE_PERCENT); EXPECT_FALSE([controller_ dropShadowView]); EXPECT_FALSE([controller_ drawDropShadow]); - mode.mode = chrome::search::Mode::MODE_NTP; + mode.mode = SearchMode::MODE_NTP; instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); EXPECT_FALSE([controller_ dropShadowView]); EXPECT_FALSE([controller_ drawDropShadow]); @@ -130,8 +130,8 @@ IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, NoShadowFullHeight) { // Verify that a shadow is shown when the overlay is in search mode. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, NoShadowNTP) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; + SearchMode mode; + mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); EXPECT_TRUE([controller_ dropShadowView]); EXPECT_TRUE([controller_ drawDropShadow]); @@ -146,8 +146,8 @@ IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, NoShadowNTP) { // Verify that the shadow is hidden when hiding the overlay. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, HideShadow) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; + SearchMode mode; + mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); EXPECT_TRUE([controller_ dropShadowView]); @@ -157,8 +157,8 @@ IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, HideShadow) { // Verify that the web contents is not hidden when just the height changes. IN_PROC_BROWSER_TEST_F(OverlayableContentsControllerTest, HeightChangeNoHide) { - chrome::search::Mode mode; - mode.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; + SearchMode mode; + mode.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; instant_overlay_model_.SetOverlayState(mode, 10, INSTANT_SIZE_PERCENT); registrar_.Add(this, diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm index ae84339..80759c6 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm @@ -191,7 +191,7 @@ TEST_F(WrenchMenuControllerTest, RecentTabsElideTitle) { // Verify that |RecentTabsMenuModelDelegate| is deleted before the model // it's observing. TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); [controller_ menuNeedsUpdate:[controller_ menu]]; // If the delete order is wrong then the test will crash on exit. } diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc index 935c1a4..08dccbd 100644 --- a/chrome/browser/ui/extensions/extension_install_ui_default.cc +++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc @@ -247,7 +247,7 @@ void ExtensionInstallUI::OpenAppInstalledUI(Profile* profile, content::Details<const std::string>(&app_id)); #else Browser* browser = FindOrCreateVisibleBrowser(profile); - GURL url(chrome::search::IsInstantExtendedAPIEnabled() ? + GURL url(chrome::IsInstantExtendedAPIEnabled() ? chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); chrome::NavigateParams params( chrome::GetSingletonTabNavigateParams(browser, url)); diff --git a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc index ee789bc..6a066d8 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc @@ -22,10 +22,9 @@ #include "ui/gfx/rect.h" #include "ui/gfx/skia_utils_gtk.h" -InfoBarContainerGtk::InfoBarContainerGtk( - InfoBarContainer::Delegate* delegate, - chrome::search::SearchModel* search_model, - Profile* profile) +InfoBarContainerGtk::InfoBarContainerGtk(InfoBarContainer::Delegate* delegate, + SearchModel* search_model, + Profile* profile) : InfoBarContainer(delegate, search_model), profile_(profile), container_(gtk_vbox_new(FALSE, 0)) { diff --git a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.h b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.h index ab83d40..a49c05c 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.h +++ b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.h @@ -38,7 +38,7 @@ typedef struct _GtkWidget GtkWidget; class InfoBarContainerGtk : public InfoBarContainer { public: InfoBarContainerGtk(InfoBarContainer::Delegate* delegate, - chrome::search::SearchModel* search_model, + SearchModel* search_model, Profile* profile); virtual ~InfoBarContainerGtk(); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index 0bb0c6e..eb3f398 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -1235,7 +1235,7 @@ void OmniboxViewGtk::HandlePopulatePopup(GtkWidget* sender, GtkMenu* menu) { g_free(text); // Copy URL menu item. - if (chrome::search::IsQueryExtractionEnabled()) { + if (chrome::IsQueryExtractionEnabled()) { GtkWidget* copy_url_menuitem = gtk_menu_item_new_with_mnemonic( ui::ConvertAcceleratorsFromWindowsStyle( l10n_util::GetStringUTF8(IDS_COPY_URL)).c_str()); diff --git a/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc b/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc index e065a33..3760009 100644 --- a/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc +++ b/chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.cc @@ -69,7 +69,7 @@ void OmniboxCurrentPageDelegateImpl::NotifySearchTabHelper( bool cancelling) { if (!controller_->GetWebContents()) return; - chrome::search::SearchTabHelper::FromWebContents( + SearchTabHelper::FromWebContents( controller_->GetWebContents())->OmniboxEditModelChanged( user_input_in_progress, cancelling); } diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc index 0e6c336..481c079 100644 --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc @@ -130,7 +130,7 @@ OmniboxEditModel::OmniboxEditModel(OmniboxView* view, // Use a restricted subset of the autocomplete providers if we're using the // Instant Extended API, as it doesn't support them all. autocomplete_controller_.reset(new AutocompleteController(profile, this, - chrome::search::IsInstantExtendedAPIEnabled() ? + chrome::IsInstantExtendedAPIEnabled() ? AutocompleteClassifier::kInstantExtendedOmniboxProviders : AutocompleteClassifier::kDefaultOmniboxProviders)); delegate_.reset(new OmniboxCurrentPageDelegateImpl(controller, profile)); diff --git a/chrome/browser/ui/search/instant_browsertest.cc b/chrome/browser/ui/search/instant_browsertest.cc index 43fdb0e..488c3a1 100644 --- a/chrome/browser/ui/search/instant_browsertest.cc +++ b/chrome/browser/ui/search/instant_browsertest.cc @@ -754,7 +754,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_NewWindowDismissesInstant) { EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); InstantTestModelObserver observer(instant()->model(), - chrome::search::Mode::MODE_DEFAULT); + SearchMode::MODE_DEFAULT); chrome::NewEmptyWindow(browser()->profile(), chrome::HOST_DESKTOP_TYPE_NATIVE); observer.WaitForDesiredOverlayState(); diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc index d7bc0e6..fd7f30d 100644 --- a/chrome/browser/ui/search/instant_controller.cc +++ b/chrome/browser/ui/search/instant_controller.cc @@ -179,7 +179,7 @@ void EnsureSearchTermsAreSet(content::WebContents* contents, // If search terms are already correct or there is already a transient entry // (there shouldn't be), bail out early. - if (chrome::search::GetSearchTerms(contents) == search_terms || + if (chrome::GetSearchTerms(contents) == search_terms || controller->GetTransientEntry()) return; @@ -191,12 +191,10 @@ void EnsureSearchTermsAreSet(content::WebContents* contents, false, std::string(), contents->GetBrowserContext()); - transient->SetExtraData(chrome::search::kInstantExtendedSearchTermsKey, - search_terms); + transient->SetExtraData(chrome::kInstantExtendedSearchTermsKey, search_terms); controller->SetTransientEntry(transient); - chrome::search::SearchTabHelper::FromWebContents(contents)-> - NavigationEntryUpdated(); + SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); } bool GetURLForMostVisitedItemID(Profile* profile, @@ -226,7 +224,7 @@ bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) { } // namespace -InstantController::InstantController(chrome::BrowserInstantController* browser, +InstantController::InstantController(BrowserInstantController* browser, bool extended_enabled) : browser_(browser), extended_enabled_(extended_enabled), @@ -317,7 +315,7 @@ bool InstantController::Update(const AutocompleteMatch& match, // "return false" conditions is hit, suggestions will be disallowed. If the // query is sent to the overlay, the mode is set to "allow" further below. if (!extended_enabled_) - search_mode_.mode = chrome::search::Mode::MODE_DEFAULT; + search_mode_.mode = SearchMode::MODE_DEFAULT; last_match_was_search_ = AutocompleteMatch::IsSearchType(match.type) && !user_text.empty(); @@ -450,7 +448,7 @@ bool InstantController::Update(const AutocompleteMatch& match, // Allow search suggestions. In extended mode, SearchModeChanged() will set // this, but it's not called in non-extended mode, so fake it. if (!extended_enabled_) - search_mode_.mode = chrome::search::Mode::MODE_SEARCH_SUGGESTIONS; + search_mode_.mode = SearchMode::MODE_SEARCH_SUGGESTIONS; if (instant_tab_) { // If we have an |instant_tab_| but it doesn't support Instant yet, sever @@ -783,7 +781,7 @@ bool InstantController::CommitIfPossible(InstantCommitType type) { content::NotificationService::NoDetails()); // Hide explicitly. See comments in HideOverlay() for why. - model_.SetOverlayState(chrome::search::Mode(), 0, INSTANT_SIZE_PERCENT); + model_.SetOverlayState(SearchMode(), 0, INSTANT_SIZE_PERCENT); // Delay deletion as we could've gotten here from an InstantOverlay method. MessageLoop::current()->DeleteSoon(FROM_HERE, overlay_.release()); @@ -839,9 +837,8 @@ void InstantController::OmniboxFocusChanged( } } -void InstantController::SearchModeChanged( - const chrome::search::Mode& old_mode, - const chrome::search::Mode& new_mode) { +void InstantController::SearchModeChanged(const SearchMode& old_mode, + const SearchMode& new_mode) { if (!extended_enabled_) return; @@ -1376,7 +1373,7 @@ void InstantController::HideInternal() { // change the state just yet; else we may hide the overlay unnecessarily. // Instead, the state will be set correctly after the commit is done. if (GetOverlayContents()) { - model_.SetOverlayState(chrome::search::Mode(), 0, INSTANT_SIZE_PERCENT); + model_.SetOverlayState(SearchMode(), 0, INSTANT_SIZE_PERCENT); allow_overlay_to_show_search_suggestions_ = false; // Send a message asking the overlay to clear out old results. @@ -1402,7 +1399,7 @@ void InstantController::ShowOverlay(int height, InstantSizeUnits units) { // The page is trying to hide itself. Hide explicitly (i.e., don't use // HideOverlay()) so that it can change its mind. if (height == 0) { - model_.SetOverlayState(chrome::search::Mode(), 0, INSTANT_SIZE_PERCENT); + model_.SetOverlayState(SearchMode(), 0, INSTANT_SIZE_PERCENT); return; } @@ -1468,8 +1465,8 @@ bool InstantController::GetInstantURL(Profile* profile, return true; } - const GURL instant_url_obj = - chrome::search::GetInstantURL(profile, omnibox_bounds_.x()); + const GURL instant_url_obj = chrome::GetInstantURL(profile, + omnibox_bounds_.x()); if (!instant_url_obj.is_valid()) return false; diff --git a/chrome/browser/ui/search/instant_controller.h b/chrome/browser/ui/search/instant_controller.h index 8b7a987..b2ca248 100644 --- a/chrome/browser/ui/search/instant_controller.h +++ b/chrome/browser/ui/search/instant_controller.h @@ -34,15 +34,12 @@ struct AutocompleteMatch; class AutocompleteProvider; +class BrowserInstantController; class InstantNTP; class InstantOverlay; class InstantTab; class TemplateURL; -namespace chrome { -class BrowserInstantController; -} - namespace content { class WebContents; } @@ -72,7 +69,7 @@ class WebContents; class InstantController : public InstantPage::Delegate, public content::NotificationObserver { public: - InstantController(chrome::BrowserInstantController* browser, + InstantController(BrowserInstantController* browser, bool extended_enabled); virtual ~InstantController(); @@ -142,8 +139,8 @@ class InstantController : public InstantPage::Delegate, // The search mode in the active tab has changed. Pass the message down to // the overlay which will notify the renderer. Create |instant_tab_| if the // |new_mode| reflects an Instant search results page. - void SearchModeChanged(const chrome::search::Mode& old_mode, - const chrome::search::Mode& new_mode); + void SearchModeChanged(const SearchMode& old_mode, + const SearchMode& new_mode); // The user switched tabs. Hide the overlay. Create |instant_tab_| if the // newly active tab is an Instant search results page. @@ -365,7 +362,7 @@ class InstantController : public InstantPage::Delegate, // returns false.) bool FixSuggestion(InstantSuggestion* suggestion) const; - chrome::BrowserInstantController* const browser_; + BrowserInstantController* const browser_; // Whether the extended API and regular API are enabled. If both are false, // Instant is effectively disabled. @@ -420,7 +417,7 @@ class InstantController : public InstantPage::Delegate, OmniboxFocusState omnibox_focus_state_; // The search model mode for the active tab. - chrome::search::Mode search_mode_; + SearchMode search_mode_; // Current omnibox popup bounds. gfx::Rect popup_bounds_; diff --git a/chrome/browser/ui/search/instant_extended_browsertest.cc b/chrome/browser/ui/search/instant_extended_browsertest.cc index 322e323..3bfeb77 100644 --- a/chrome/browser/ui/search/instant_extended_browsertest.cc +++ b/chrome/browser/ui/search/instant_extended_browsertest.cc @@ -76,7 +76,7 @@ class InstantExtendedTest : public InProcessBrowserTest, } protected: virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); ASSERT_TRUE(https_test_server().Start()); GURL instant_url = https_test_server().GetURL( "files/instant_extended.html?strk=1&"); @@ -134,7 +134,7 @@ class InstantPolicyTest : public ExtensionBrowserTest, public InstantTestBase { protected: virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); ASSERT_TRUE(https_test_server().Start()); GURL instant_url = https_test_server().GetURL( "files/instant_extended.html?strk=1&"); @@ -518,7 +518,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPIsUsedInNewTab) { content::WebContents* active_tab = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(ntp_contents, active_tab); - EXPECT_TRUE(chrome::search::IsInstantNTP(active_tab)); + EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); } IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPIsUsedInSameTab) { @@ -540,7 +540,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPIsUsedInSameTab) { content::WebContents* active_tab = browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ(ntp_contents, active_tab); - EXPECT_TRUE(chrome::search::IsInstantNTP(active_tab)); + EXPECT_TRUE(chrome::IsInstantNTP(active_tab)); } IN_PROC_BROWSER_TEST_F(InstantExtendedTest, PreloadedNTPForWrongProvider) { diff --git a/chrome/browser/ui/search/instant_extended_manual_browsertest.cc b/chrome/browser/ui/search/instant_extended_manual_browsertest.cc index c2604a2..37e5807 100644 --- a/chrome/browser/ui/search/instant_extended_manual_browsertest.cc +++ b/chrome/browser/ui/search/instant_extended_manual_browsertest.cc @@ -53,7 +53,7 @@ class InstantExtendedManualTest : public InProcessBrowserTest, protected: virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); } content::WebContents* active_tab() { @@ -76,7 +76,7 @@ class InstantExtendedManualTest : public InProcessBrowserTest, bool PressBackspaceAndWaitForOverlayToShow() { InstantTestModelObserver observer( - instant()->model(), chrome::search::Mode::MODE_SEARCH_SUGGESTIONS); + instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS); bool result = PressBackspace(); observer.WaitForDesiredOverlayState(); return result; diff --git a/chrome/browser/ui/search/instant_loader.cc b/chrome/browser/ui/search/instant_loader.cc index 2137598..092c835 100644 --- a/chrome/browser/ui/search/instant_loader.cc +++ b/chrome/browser/ui/search/instant_loader.cc @@ -91,7 +91,7 @@ void InstantLoader::SetContents(scoped_ptr<content::WebContents> new_contents) { CoreTabHelper::FromWebContents(contents())->set_delegate(this); // Tab helpers used when committing an overlay. - chrome::search::SearchTabHelper::CreateForWebContents(contents()); + SearchTabHelper::CreateForWebContents(contents()); HistoryTabHelper::CreateForWebContents(contents()); // Observers. diff --git a/chrome/browser/ui/search/instant_overlay_model.cc b/chrome/browser/ui/search/instant_overlay_model.cc index fba64ee..09a668b 100644 --- a/chrome/browser/ui/search/instant_overlay_model.cc +++ b/chrome/browser/ui/search/instant_overlay_model.cc @@ -17,7 +17,7 @@ InstantOverlayModel::InstantOverlayModel(InstantController* controller) InstantOverlayModel::~InstantOverlayModel() { } -void InstantOverlayModel::SetOverlayState(const chrome::search::Mode& mode, +void InstantOverlayModel::SetOverlayState(const SearchMode& mode, int height, InstantSizeUnits height_units) { if (mode_.mode == mode.mode && height_ == height && diff --git a/chrome/browser/ui/search/instant_overlay_model.h b/chrome/browser/ui/search/instant_overlay_model.h index ccad808..e7c23e8 100644 --- a/chrome/browser/ui/search/instant_overlay_model.h +++ b/chrome/browser/ui/search/instant_overlay_model.h @@ -26,11 +26,11 @@ class InstantOverlayModel { // InstantOverlayModel only uses Mode::mode internally. Other parts of Mode, // such as Mode::origin, may have arbitrary values, and should be ignored. - const chrome::search::Mode& mode() const { return mode_; } + const SearchMode& mode() const { return mode_; } int height() const { return height_; } InstantSizeUnits height_units() const { return height_units_; } - void SetOverlayState(const chrome::search::Mode& mode, + void SetOverlayState(const SearchMode& mode, int height, InstantSizeUnits height_units); @@ -42,7 +42,7 @@ class InstantOverlayModel { void RemoveObserver(InstantOverlayModelObserver* observer); private: - chrome::search::Mode mode_; + SearchMode mode_; int height_; InstantSizeUnits height_units_; diff --git a/chrome/browser/ui/search/instant_test_utils.cc b/chrome/browser/ui/search/instant_test_utils.cc index cc78dc6..7b0e649 100644 --- a/chrome/browser/ui/search/instant_test_utils.cc +++ b/chrome/browser/ui/search/instant_test_utils.cc @@ -33,7 +33,7 @@ std::string WrapScript(const std::string& script) { InstantTestModelObserver::InstantTestModelObserver( InstantOverlayModel* model, - chrome::search::Mode::Type desired_mode_type) + SearchMode::Type desired_mode_type) : model_(model), desired_mode_type_(desired_mode_type) { model_->AddObserver(this); @@ -143,7 +143,7 @@ void InstantTestBase::SetOmniboxText(const std::string& text) { void InstantTestBase::SetOmniboxTextAndWaitForOverlayToShow( const std::string& text) { InstantTestModelObserver observer( - instant()->model(), chrome::search::Mode::MODE_SEARCH_SUGGESTIONS); + instant()->model(), SearchMode::MODE_SEARCH_SUGGESTIONS); SetOmniboxText(text); observer.WaitForDesiredOverlayState(); } diff --git a/chrome/browser/ui/search/instant_test_utils.h b/chrome/browser/ui/search/instant_test_utils.h index 0f89f68..3554bef 100644 --- a/chrome/browser/ui/search/instant_test_utils.h +++ b/chrome/browser/ui/search/instant_test_utils.h @@ -31,7 +31,7 @@ class WebContents; class InstantTestModelObserver : public InstantOverlayModelObserver { public: InstantTestModelObserver(InstantOverlayModel* model, - chrome::search::Mode::Type desired_mode_type); + SearchMode::Type desired_mode_type); ~InstantTestModelObserver(); void WaitForDesiredOverlayState(); @@ -41,7 +41,7 @@ class InstantTestModelObserver : public InstantOverlayModelObserver { private: InstantOverlayModel* const model_; - const chrome::search::Mode::Type desired_mode_type_; + const SearchMode::Type desired_mode_type_; base::RunLoop run_loop_; DISALLOW_COPY_AND_ASSIGN(InstantTestModelObserver); diff --git a/chrome/browser/ui/search/search_delegate.cc b/chrome/browser/ui/search/search_delegate.cc index 6c0ec71..2af2654 100644 --- a/chrome/browser/ui/search/search_delegate.cc +++ b/chrome/browser/ui/search/search_delegate.cc @@ -7,9 +7,6 @@ #include "chrome/browser/ui/search/search_model.h" #include "chrome/browser/ui/search/search_tab_helper.h" -namespace chrome { -namespace search { - SearchDelegate::SearchDelegate(SearchModel* browser_search_model, ToolbarModel* toolbar_model) : browser_model_(browser_search_model), @@ -28,8 +25,7 @@ void SearchDelegate::ModelChanged(const SearchModel::State& old_state, void SearchDelegate::OnTabActivated(content::WebContents* web_contents) { if (tab_model_) tab_model_->RemoveObserver(this); - tab_model_ = - chrome::search::SearchTabHelper::FromWebContents(web_contents)->model(); + tab_model_ = SearchTabHelper::FromWebContents(web_contents)->model(); browser_model_->SetState(tab_model_->state()); tab_model_->AddObserver(this); } @@ -43,13 +39,10 @@ void SearchDelegate::OnTabDetached(content::WebContents* web_contents) { } void SearchDelegate::StopObservingTab(content::WebContents* web_contents) { - chrome::search::SearchTabHelper* search_tab_helper = - chrome::search::SearchTabHelper::FromWebContents(web_contents); + SearchTabHelper* search_tab_helper = + SearchTabHelper::FromWebContents(web_contents); if (search_tab_helper->model() == tab_model_) { tab_model_->RemoveObserver(this); tab_model_ = NULL; } } - -} // namespace search -} // namespace chrome diff --git a/chrome/browser/ui/search/search_delegate.h b/chrome/browser/ui/search/search_delegate.h index 11b105c..da8c8c4 100644 --- a/chrome/browser/ui/search/search_delegate.h +++ b/chrome/browser/ui/search/search_delegate.h @@ -15,9 +15,6 @@ namespace content { class WebContents; } -namespace chrome { -namespace search { - class SearchModel; // The SearchDelegate class acts as a helper to the Browser class. @@ -63,7 +60,4 @@ class SearchDelegate : public SearchModelObserver { DISALLOW_COPY_AND_ASSIGN(SearchDelegate); }; -} // namespace search -} // namespace chrome - #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_DELEGATE_H_ diff --git a/chrome/browser/ui/search/search_delegate_unittest.cc b/chrome/browser/ui/search/search_delegate_unittest.cc index 777fa6b..c9fee29 100644 --- a/chrome/browser/ui/search/search_delegate_unittest.cc +++ b/chrome/browser/ui/search/search_delegate_unittest.cc @@ -9,15 +9,12 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/browser_with_test_window_test.h" -namespace chrome { -namespace search { - typedef BrowserWithTestWindowTest SearchDelegateTest; // Test the propagation of search "mode" changes from the tab's search model to // the browser's search model. TEST_F(SearchDelegateTest, SearchModel) { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); // Initial state. EXPECT_TRUE(browser()->search_model()->mode().is_default()); @@ -26,8 +23,8 @@ TEST_F(SearchDelegateTest, SearchModel) { AddTab(browser(), GURL("http://foo/0")); content::WebContents* web_contents = browser()->tab_strip_model()->GetWebContentsAt(0); - chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()-> - SetMode(Mode(Mode::MODE_NTP, Mode::ORIGIN_NTP)); + SearchTabHelper::FromWebContents(web_contents)->model()-> + SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); // Add second tab, make it active, and make sure its mode changes @@ -35,16 +32,14 @@ TEST_F(SearchDelegateTest, SearchModel) { AddTab(browser(), GURL("http://foo/1")); browser()->tab_strip_model()->ActivateTabAt(1, true); web_contents = browser()->tab_strip_model()->GetWebContentsAt(1); - chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()-> - SetMode(Mode(Mode::MODE_SEARCH_RESULTS, Mode::ORIGIN_DEFAULT)); + SearchTabHelper::FromWebContents(web_contents)->model()-> + SetMode(SearchMode(SearchMode::MODE_SEARCH_RESULTS, + SearchMode::ORIGIN_DEFAULT)); EXPECT_TRUE(browser()->search_model()->mode().is_search()); // The first tab is not active so changes should not propagate. web_contents = browser()->tab_strip_model()->GetWebContentsAt(0); - chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()-> - SetMode(Mode(Mode::MODE_NTP, Mode::ORIGIN_NTP)); + SearchTabHelper::FromWebContents(web_contents)->model()-> + SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); EXPECT_TRUE(browser()->search_model()->mode().is_search()); } - -} // namespace search -} // namespace chrome diff --git a/chrome/browser/ui/search/search_model.cc b/chrome/browser/ui/search/search_model.cc index 6637b8f..53d0fcc 100644 --- a/chrome/browser/ui/search/search_model.cc +++ b/chrome/browser/ui/search/search_model.cc @@ -7,9 +7,6 @@ #include "chrome/browser/search/search.h" #include "chrome/browser/ui/search/search_model_observer.h" -namespace chrome { -namespace search { - SearchModel::SearchModel() { } @@ -30,7 +27,7 @@ bool SearchModel::ShouldChangeTopBarsVisibility(const State& old_state, } void SearchModel::SetState(const State& new_state) { - DCHECK(IsInstantExtendedAPIEnabled()) + DCHECK(chrome::IsInstantExtendedAPIEnabled()) << "Please do not try to set the SearchModel mode without first " << "checking if Search is enabled."; @@ -44,8 +41,8 @@ void SearchModel::SetState(const State& new_state) { ModelChanged(old_state, state_)); } -void SearchModel::SetMode(const Mode& new_mode) { - DCHECK(IsInstantExtendedAPIEnabled()) +void SearchModel::SetMode(const SearchMode& new_mode) { + DCHECK(chrome::IsInstantExtendedAPIEnabled()) << "Please do not try to set the SearchModel mode without first " << "checking if Search is enabled."; @@ -66,7 +63,7 @@ void SearchModel::SetMode(const Mode& new_mode) { } void SearchModel::SetTopBarsVisible(bool visible) { - DCHECK(IsInstantExtendedAPIEnabled()) + DCHECK(chrome::IsInstantExtendedAPIEnabled()) << "Please do not try to set the SearchModel mode without first " << "checking if Search is enabled."; @@ -87,6 +84,3 @@ void SearchModel::AddObserver(SearchModelObserver* observer) { void SearchModel::RemoveObserver(SearchModelObserver* observer) { observers_.RemoveObserver(observer); } - -} // namespace search -} // namespace chrome diff --git a/chrome/browser/ui/search/search_model.h b/chrome/browser/ui/search/search_model.h index 44322a6..9514757 100644 --- a/chrome/browser/ui/search/search_model.h +++ b/chrome/browser/ui/search/search_model.h @@ -9,9 +9,6 @@ #include "base/observer_list.h" #include "chrome/common/search_types.h" -namespace chrome { -namespace search { - class SearchModelObserver; // An observable model for UI components that care about search model state @@ -26,7 +23,8 @@ class SearchModel { } // The display mode of UI elements such as the toolbar, the tab strip, etc. - Mode mode; + SearchMode mode; + // The visibility of top bars such as bookmark and info bars. bool top_bars_visible; }; @@ -46,10 +44,10 @@ class SearchModel { const State& state() const { return state_; } // Change the mode. Change notifications are sent to observers. - void SetMode(const Mode& mode); + void SetMode(const SearchMode& mode); // Get the active mode. - const Mode& mode() const { return state_.mode; } + const SearchMode& mode() const { return state_.mode; } // Set visibility of top bars. Change notifications are sent to observers. void SetTopBarsVisible(bool visible); @@ -71,7 +69,4 @@ class SearchModel { DISALLOW_COPY_AND_ASSIGN(SearchModel); }; -} // namespace search -} // namespace chrome - #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_H_ diff --git a/chrome/browser/ui/search/search_model_observer.h b/chrome/browser/ui/search/search_model_observer.h index 200356b..7b766d6 100644 --- a/chrome/browser/ui/search/search_model_observer.h +++ b/chrome/browser/ui/search/search_model_observer.h @@ -7,9 +7,6 @@ #include "chrome/browser/ui/search/search_model.h" -namespace chrome { -namespace search { - // This class defines the observer interface for the |SearchModel|. class SearchModelObserver { public: @@ -21,7 +18,4 @@ class SearchModelObserver { virtual ~SearchModelObserver() {} }; -} // namespace search -} // namespace chrome - #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_MODEL_OBSERVER_H_ diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc index d28404f..400a1b4 100644 --- a/chrome/browser/ui/search/search_tab_helper.cc +++ b/chrome/browser/ui/search/search_tab_helper.cc @@ -11,7 +11,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" -DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome::search::SearchTabHelper); +DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchTabHelper); namespace { @@ -23,21 +23,18 @@ bool IsNTP(const content::WebContents* contents) { if (entry && entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL)) return true; - return chrome::search::IsInstantNTP(contents); + return chrome::IsInstantNTP(contents); } bool IsSearchResults(const content::WebContents* contents) { - return !chrome::search::GetSearchTerms(contents).empty(); + return !chrome::GetSearchTerms(contents).empty(); } } // namespace -namespace chrome { -namespace search { - SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) : WebContentsObserver(web_contents), - is_search_enabled_(chrome::search::IsInstantExtendedAPIEnabled()), + is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), user_input_in_progress_(false), web_contents_(web_contents) { if (!is_search_enabled_) @@ -93,18 +90,18 @@ bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) { } void SearchTabHelper::UpdateMode() { - Mode::Type type = Mode::MODE_DEFAULT; - Mode::Origin origin = Mode::ORIGIN_DEFAULT; + SearchMode::Type type = SearchMode::MODE_DEFAULT; + SearchMode::Origin origin = SearchMode::ORIGIN_DEFAULT; if (IsNTP(web_contents_)) { - type = Mode::MODE_NTP; - origin = Mode::ORIGIN_NTP; + type = SearchMode::MODE_NTP; + origin = SearchMode::ORIGIN_NTP; } else if (IsSearchResults(web_contents_)) { - type = Mode::MODE_SEARCH_RESULTS; - origin = Mode::ORIGIN_SEARCH; + type = SearchMode::MODE_SEARCH_RESULTS; + origin = SearchMode::ORIGIN_SEARCH; } if (user_input_in_progress_) - type = Mode::MODE_SEARCH_SUGGESTIONS; - model_.SetMode(Mode(type, origin)); + type = SearchMode::MODE_SEARCH_SUGGESTIONS; + model_.SetMode(SearchMode(type, origin)); } void SearchTabHelper::OnSearchBoxShowBars(int page_id) { @@ -118,6 +115,3 @@ void SearchTabHelper::OnSearchBoxHideBars(int page_id) { Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id())); } } - -} // namespace search -} // namespace chrome diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h index e575dc2..3f6eb89 100644 --- a/chrome/browser/ui/search/search_tab_helper.h +++ b/chrome/browser/ui/search/search_tab_helper.h @@ -17,9 +17,6 @@ namespace content { class WebContents; } -namespace chrome { -namespace search { - // Per-tab search "helper". Acts as the owner and controller of the tab's // search UI model. class SearchTabHelper : public content::NotificationObserver, @@ -78,7 +75,4 @@ class SearchTabHelper : public content::NotificationObserver, DISALLOW_COPY_AND_ASSIGN(SearchTabHelper); }; -} // namespace search -} // namespace chrome - #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_TAB_HELPER_H_ diff --git a/chrome/browser/ui/search/search_ui.cc b/chrome/browser/ui/search/search_ui.cc index 59e8470..78c6546 100644 --- a/chrome/browser/ui/search/search_ui.cc +++ b/chrome/browser/ui/search/search_ui.cc @@ -9,7 +9,6 @@ #include "ui/base/theme_provider.h" namespace chrome { -namespace search { SkColor GetDetachedBookmarkBarBackgroundColor( ui::ThemeProvider* theme_provider) { @@ -33,5 +32,4 @@ SkColor GetDetachedBookmarkBarSeparatorColor( theme_provider->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT), 128); } -} // namespace search } // namespace chrome diff --git a/chrome/browser/ui/search/search_ui.h b/chrome/browser/ui/search/search_ui.h index 89e2f22..ee8d5f0 100644 --- a/chrome/browser/ui/search/search_ui.h +++ b/chrome/browser/ui/search/search_ui.h @@ -12,7 +12,6 @@ class ThemeProvider; } namespace chrome { -namespace search { // Returns the color to use to draw the detached bookmark bar background. SkColor GetDetachedBookmarkBarBackgroundColor( @@ -21,7 +20,6 @@ SkColor GetDetachedBookmarkBarBackgroundColor( // Returns the color to use to draw the detached bookmark bar separator. SkColor GetDetachedBookmarkBarSeparatorColor(ui::ThemeProvider* theme_provider); -} // namespace search } // namespace chrome #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_UI_H_ diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index 5ec4d6d..9338e96 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -968,7 +968,7 @@ void OneClickSigninHelper::RedirectToNtpOrAppsPage(bool show_bubble) { pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); } - GURL url(chrome::search::IsInstantExtendedAPIEnabled() ? + GURL url(chrome::IsInstantExtendedAPIEnabled() ? chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); content::OpenURLParams params(url, content::Referrer(), diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index 2359f3f..a6305b8 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -173,7 +173,7 @@ bool ToolbarModelImpl::ShouldDisplayURL() const { return false; #endif - if (chrome::search::IsInstantNTP(web_contents)) + if (chrome::IsInstantNTP(web_contents)) return false; return true; @@ -250,7 +250,7 @@ Profile* ToolbarModelImpl::GetProfile() const { string16 ToolbarModelImpl::GetSearchTerms() const { const WebContents* contents = delegate_->GetActiveWebContents(); - string16 search_terms = chrome::search::GetSearchTerms(contents); + string16 search_terms = chrome::GetSearchTerms(contents); // Don't extract search terms that the omnibox would treat as a navigation. // This might confuse users into believing that the search terms were the diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.h b/chrome/browser/ui/toolbar/toolbar_model_impl.h index f4a1578..80b5ae0 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.h +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.h @@ -61,7 +61,7 @@ class ToolbarModelImpl : public ToolbarModel { // Helper method to extract the profile from the navigation controller. Profile* GetProfile() const; - // Returns search terms as in chrome::search::GetSearchTerms unless those + // Returns search terms as in chrome::GetSearchTerms unless those // terms would be treated by the omnibox as a navigation. string16 GetSearchTerms() const; diff --git a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc index e130ebc..77fb1313 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc @@ -178,7 +178,7 @@ class ToolbarModelTest : public BrowserWithTestWindowTest { const std::string kInstantExtendedPrefix( "https://google.com/search?espv=1&q="); - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); ResetDefaultTemplateURL(); AddTab(browser(), GURL(chrome::kAboutBlankURL)); @@ -230,7 +230,7 @@ class ToolbarModelTest : public BrowserWithTestWindowTest { // Test that we don't replace any URLs when the query extraction is disabled. TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { - ASSERT_FALSE(chrome::search::IsQueryExtractionEnabled()) + ASSERT_FALSE(chrome::IsQueryExtractionEnabled()) << "This test expects query extraction to be disabled."; ResetDefaultTemplateURL(); @@ -247,7 +247,7 @@ TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionDisabled) { // Test that we replace URLs when the query extraction API is enabled. TEST_F(ToolbarModelTest, ShouldDisplayURLQueryExtractionEnabled) { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); ResetDefaultTemplateURL(); AddTab(browser(), GURL(chrome::kAboutBlankURL)); diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index c3bc26d..893c0b1 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -515,7 +515,7 @@ void WrenchMenuModel::Build(bool is_new_menu, bool supports_new_separators) { AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, bookmark_sub_menu_model_.get()); - if (chrome::search::IsInstantExtendedAPIEnabled()) { + if (chrome::IsInstantExtendedAPIEnabled()) { recent_tabs_sub_menu_model_.reset(new RecentTabsSubMenuModel(provider_, browser_, NULL)); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 5ac4b6d..5ef9842 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -340,13 +340,13 @@ void RecordAppLaunch(Profile* profile, GURL url) { } int GetNewtabHorizontalPadding() { - return chrome::search::IsInstantExtendedAPIEnabled() + return chrome::IsInstantExtendedAPIEnabled() ? kSearchNewTabHorizontalPadding : BookmarkBarView::kNewtabHorizontalPadding; } int GetNewtabVerticalPadding() { - return chrome::search::IsInstantExtendedAPIEnabled() + return chrome::IsInstantExtendedAPIEnabled() ? kSearchNewTabVerticalPadding : BookmarkBarView::kNewtabVerticalPadding; } @@ -1812,7 +1812,7 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { x += static_cast<int>(GetNewtabHorizontalPadding() * (1 - size_animation_->GetCurrentValue())); int ntp_bookmark_bar_height = - chrome::search::IsInstantExtendedAPIEnabled() + chrome::IsInstantExtendedAPIEnabled() ? kSearchNewTabBookmarkBarHeight : chrome::kNTPBookmarkBarHeight; prefsize.set_height( browser_defaults::kBookmarkBarHeight + @@ -1831,7 +1831,7 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { } bool BookmarkBarView::ShouldShowAppsShortcut() const { - return chrome::search::IsInstantExtendedAPIEnabled() && + return chrome::IsInstantExtendedAPIEnabled() && browser_->profile()->GetPrefs()->GetBoolean( prefs::kShowAppsShortcutInBookmarkBar) && !browser_->profile()->IsOffTheRecord(); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc index 7ad6379..87f06ee 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc @@ -32,7 +32,7 @@ TEST_F(BookmarkBarViewTest, NoAppsShortcutWithoutInstantExtended) { class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest { public: BookmarkBarViewInstantExtendedTest() { - chrome::search::EnableInstantExtendedAPIForTesting(); + chrome::EnableInstantExtendedAPIForTesting(); } protected: diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 434072d..a3ffb13 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -181,11 +181,11 @@ void PaintDetachedBookmarkBar(gfx::Canvas* canvas, ui::ThemeProvider* theme_provider) { // Paint background for detached state; if animating, this is fade in/out. canvas->DrawColor( - chrome::search::GetDetachedBookmarkBarBackgroundColor(theme_provider)); + chrome::GetDetachedBookmarkBarBackgroundColor(theme_provider)); // Draw the separators above and below bookmark bar; // if animating, these are fading in/out. SkColor separator_color = - chrome::search::GetDetachedBookmarkBarSeparatorColor(theme_provider); + chrome::GetDetachedBookmarkBarSeparatorColor(theme_provider); DetachableToolbarView::PaintHorizontalBorder(canvas, view, true, separator_color); // The bottom border needs to be 1-px thick in both regular and retina @@ -305,7 +305,7 @@ void BookmarkExtensionBackground::Paint(gfx::Canvas* canvas, // - if animating between pinned and unpinned states: // - cross-fade the bar backgrounds // - fade in/out the separator between toolbar and bookmark bar. - if (chrome::search::IsInstantExtendedAPIEnabled()) { + if (chrome::IsInstantExtendedAPIEnabled()) { if (current_state == 0.0 || current_state == 1.0) { PaintDetachedBookmarkBar(canvas, host_view_, tp); return; @@ -954,7 +954,7 @@ void BrowserView::ToolbarSizeChanged(bool is_animating) { { int top_arrow_height = 0; // Hide the arrows on the Instant Extended NTP. - if (!chrome::search::IsInstantExtendedAPIEnabled() || + if (!chrome::IsInstantExtendedAPIEnabled() || !browser()->search_model()->mode().is_ntp()) { const LocationIconView* location_icon_view = toolbar_->location_bar()->location_icon_view(); diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 5b6470f..71ef61c 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc @@ -268,7 +268,7 @@ void BrowserViewLayout::Layout(views::View* host) { // "removing" the bookmark bar/infobars). To prevent this, we save off the // content origin here, then once we finish laying things out, force the // contents to continue to display from that origin. - const chrome::search::Mode& mode = browser()->search_model()->mode(); + const SearchMode& mode = browser()->search_model()->mode(); views::WebView* contents = browser_view_->contents_container_; int overlay_height = contents_container_->overlay_height(); gfx::Point old_contents_origin; diff --git a/chrome/browser/ui/views/frame/instant_overlay_controller_views.cc b/chrome/browser/ui/views/frame/instant_overlay_controller_views.cc index 0478599..0cebc7b 100644 --- a/chrome/browser/ui/views/frame/instant_overlay_controller_views.cc +++ b/chrome/browser/ui/views/frame/instant_overlay_controller_views.cc @@ -31,7 +31,7 @@ void InstantOverlayControllerViews::OverlayStateChanged( const InstantOverlayModel& model) { // Set top bars (bookmark and info bars) visibility if Instant Extended API // is enabled. - bool set_top_bars_visibility = chrome::search::IsInstantExtendedAPIEnabled(); + bool set_top_bars_visibility = chrome::IsInstantExtendedAPIEnabled(); if (model.mode().is_ntp() || model.mode().is_search_suggestions()) { // Show the overlay. @@ -60,9 +60,8 @@ void InstantOverlayControllerViews::OverlayStateChanged( if (set_top_bars_visibility) { // Set top bars visibility for current tab via |SearchTabHelper| of current // active web contents: top bars are hidden if there's overlay. - chrome::search::SearchTabHelper* search_tab_helper = - chrome::search::SearchTabHelper::FromWebContents( - browser_->tab_strip_model()->GetActiveWebContents()); + SearchTabHelper* search_tab_helper = SearchTabHelper::FromWebContents( + browser_->tab_strip_model()->GetActiveWebContents()); if (search_tab_helper) search_tab_helper->model()->SetTopBarsVisible(!overlay_); } diff --git a/chrome/browser/ui/views/infobars/infobar_container_view.cc b/chrome/browser/ui/views/infobars/infobar_container_view.cc index 1a3e0d4..072b1c8 100644 --- a/chrome/browser/ui/views/infobars/infobar_container_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_container_view.cc @@ -14,9 +14,8 @@ // static const char InfoBarContainerView::kViewClassName[] = "InfoBarContainerView"; -InfoBarContainerView::InfoBarContainerView( - Delegate* delegate, - chrome::search::SearchModel* search_model) +InfoBarContainerView::InfoBarContainerView(Delegate* delegate, + SearchModel* search_model) : InfoBarContainer(delegate, search_model) { set_id(VIEW_ID_INFO_BAR_CONTAINER); } diff --git a/chrome/browser/ui/views/infobars/infobar_container_view.h b/chrome/browser/ui/views/infobars/infobar_container_view.h index b93dedd..e7c1724 100644 --- a/chrome/browser/ui/views/infobars/infobar_container_view.h +++ b/chrome/browser/ui/views/infobars/infobar_container_view.h @@ -15,7 +15,7 @@ class InfoBarContainerView : public views::AccessiblePaneView, static const char kViewClassName[]; explicit InfoBarContainerView(Delegate* delegate, - chrome::search::SearchModel* search_model); + SearchModel* search_model); virtual ~InfoBarContainerView(); private: diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc index cfca04c..7f53893 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc @@ -64,7 +64,7 @@ OmniboxPopupView* OmniboxPopupContentsView::Create( OmniboxView* omnibox_view, OmniboxEditModel* edit_model, views::View* location_bar) { - if (chrome::search::IsInstantExtendedAPIEnabled()) + if (chrome::IsInstantExtendedAPIEnabled()) return new OmniboxPopupNonView(edit_model); OmniboxPopupContentsView* view = NULL; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index ef77a34..80aa662 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -709,7 +709,7 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, IDS_EDIT_SEARCH_ENGINES); - if (chrome::search::IsQueryExtractionEnabled()) { + if (chrome::IsQueryExtractionEnabled()) { int copy_position = menu_contents->GetIndexOfCommandId(IDS_APP_COPY); DCHECK(copy_position >= 0); menu_contents->InsertItemWithStringIdAt( diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index f541779..94533b0 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -2800,7 +2800,7 @@ void OmniboxViewWin::BuildContextMenu() { context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); context_menu_contents_->AddItemWithStringId(IDC_CUT, IDS_CUT); context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); - if (chrome::search::IsQueryExtractionEnabled()) + if (chrome::IsQueryExtractionEnabled()) context_menu_contents_->AddItemWithStringId(IDC_COPY_URL, IDS_COPY_URL); context_menu_contents_->AddItemWithStringId(IDC_PASTE, IDS_PASTE); // GetContextualLabel() will override this next label with the diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index d756cb0..3408700 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -1107,7 +1107,7 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { // On mobile we deal with foreign sessions differently. #if !defined(OS_ANDROID) && !defined(OS_IOS) - if (chrome::search::IsInstantExtendedAPIEnabled()) { + if (chrome::IsInstantExtendedAPIEnabled()) { web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); web_ui->AddMessageHandler(new NTPLoginHandler()); } diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc index 9dd033b..20f44ce 100644 --- a/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc @@ -204,7 +204,7 @@ void OmniboxUIHandler::StartOmniboxQuery(const base::ListValue* input) { void OmniboxUIHandler::ResetController() { controller_.reset(new AutocompleteController(profile_, this, - chrome::search::IsInstantExtendedAPIEnabled() ? + chrome::IsInstantExtendedAPIEnabled() ? AutocompleteClassifier::kInstantExtendedOmniboxProviders : AutocompleteClassifier::kDefaultOmniboxProviders)); } diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 8c17095..af1c9cf 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -422,7 +422,7 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) { "defaultSearchGroupLabel", l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); - std::string instant_pref_name = chrome::search::GetInstantPrefName(); + std::string instant_pref_name = chrome::GetInstantPrefName(); int instant_message_id = instant_pref_name == prefs::kInstantEnabled ? IDS_INSTANT_PREF_WITH_WARNING : IDS_INSTANT_EXTENDED_PREF_WITH_WARNING; string16 instant_learn_more_url = ASCIIToUTF16(chrome::kInstantLearnMoreURL); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 34cd96f..7a7c5cf 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -179,9 +179,9 @@ IPC_STRUCT_TRAITS_BEGIN(InstantSuggestion) IPC_STRUCT_TRAITS_MEMBER(query) IPC_STRUCT_TRAITS_END() -IPC_ENUM_TRAITS(chrome::search::Mode::Type) -IPC_ENUM_TRAITS(chrome::search::Mode::Origin) -IPC_STRUCT_TRAITS_BEGIN(chrome::search::Mode) +IPC_ENUM_TRAITS(SearchMode::Type) +IPC_ENUM_TRAITS(SearchMode::Origin) +IPC_STRUCT_TRAITS_BEGIN(SearchMode) IPC_STRUCT_TRAITS_MEMBER(mode) IPC_STRUCT_TRAITS_MEMBER(origin) IPC_STRUCT_TRAITS_END() @@ -324,7 +324,7 @@ IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxCancelSelection, string16 /* value */) IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxModeChanged, - chrome::search::Mode /* mode */) + SearchMode /* mode */) IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxSetDisplayInstantResults, bool /* display_instant_results */) diff --git a/chrome/common/search_types.h b/chrome/common/search_types.h index 5fb85e7..15cb878 100644 --- a/chrome/common/search_types.h +++ b/chrome/common/search_types.h @@ -5,12 +5,9 @@ #ifndef CHROME_COMMON_SEARCH_TYPES_H_ #define CHROME_COMMON_SEARCH_TYPES_H_ -namespace chrome { -namespace search { - // The Mode structure encodes the visual states encountered when interacting // with the NTP and the Omnibox. -struct Mode { +struct SearchMode { // The visual state that applies to the current interaction. enum Type { // The default state means anything but the following states. @@ -38,19 +35,19 @@ struct Mode { ORIGIN_SEARCH, }; - Mode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) { + SearchMode() : mode(MODE_DEFAULT), origin(ORIGIN_DEFAULT) { } - Mode(Type in_mode, Origin in_origin) + SearchMode(Type in_mode, Origin in_origin) : mode(in_mode), origin(in_origin) { } - bool operator==(const Mode& rhs) const { + bool operator==(const SearchMode& rhs) const { return mode == rhs.mode && origin == rhs.origin; } - bool operator!=(const Mode& rhs) const { + bool operator!=(const SearchMode& rhs) const { return !(*this == rhs); } @@ -90,7 +87,4 @@ struct Mode { Origin origin; }; -} // namespace search -} // namespace chrome - #endif // CHROME_COMMON_SEARCH_TYPES_H_ |