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

Unified Diff: chrome/browser/ui/search/search.h

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/search/search.h
diff --git a/chrome/browser/ui/search/search.h b/chrome/browser/ui/search/search.h
index c66244ef570a7ea6f2ed20229cefa313d21a7185..4a02e7041d614d6fd17d838dacda7359fc632c20 100644
--- a/chrome/browser/ui/search/search.h
+++ b/chrome/browser/ui/search/search.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "base/string16.h"
class GURL;
+class PrefRegistrySyncable;
class Profile;
class TemplateURL;
class TemplateURLRef;
@@ -33,19 +34,6 @@ extern const char kInstantExtendedSearchTermsKey[];
// The URL for the local omnibox popup (rendered in a WebContents).
extern const char kLocalOmniboxPopupURL[];
-// The default value we should assign to the instant_extended.enabled pref.
-// As with other prefs, the default is used only when the user hasn't toggled
-// the pref explicitly.
-enum InstantExtendedDefault {
- INSTANT_DEFAULT_ON, // Default the pref to be enabled.
- INSTANT_USE_EXISTING, // Use the current value of the instant.enabled pref.
- INSTANT_DEFAULT_OFF, // Default the pref to be disabled.
-};
-
-// Returns an enum value indicating which mode to set the new
-// instant_extended.enabled pref to by default.
-InstantExtendedDefault GetInstantExtendedDefaultSetting();
-
// Returns whether the Instant Extended API is enabled in this profile.
bool IsInstantExtendedAPIEnabled(const Profile* profile);
@@ -73,6 +61,38 @@ string16 GetSearchTerms(const content::WebContents* contents);
// Returns true if |url| should be rendered in the Instant renderer process.
bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile);
+// Registers Instant-related user preferences. Called at startup.
+void RegisterUserPrefs(PrefRegistrySyncable* registry);
+
+// Returns prefs::kInstantExtendedEnabled in extended mode;
+// prefs::kInstantEnabled otherwise.
+const char* GetInstantPrefName(const Profile* profile);
+
+// Returns whether the Instant pref (as per GetInstantPrefName()) is enabled.
+bool IsInstantPrefEnabled(Profile* profile);
+
+// Sets the default value of prefs::kInstantExtendedEnabled, based on field
+// trials and the current value of prefs::kInstantEnabled.
+void SetInstantExtendedPrefDefault(Profile* profile);
+
+// Returns the Instant URL of the default search engine. Returns an empty GURL
+// if the engine doesn't have an Instant URL, or if it shouldn't be used (say
+// because it doesn't satisfy the requirements for extended mode or if Instant
+// is disabled through preferences). Callers must check that the returned URL is
+// valid before using it.
+// NOTE: This method expands the default search engine's instant_url, so it
+// shouldn't be called from SearchTermsData or other such code that would lead
+// to an infinite recursion.
+GURL GetInstantURL(Profile* profile);
+
+// Instant (loading a remote server page and talking to it using the searchbox
+// API) is considered enabled if there's a valid Instant URL that can be used,
+// so this simply returns whether GetInstantURL() is a valid URL.
+// NOTE: This method expands the default search engine's instant_url, so it
+// shouldn't be called from SearchTermsData or other such code that would lead
+// to an infinite recursion.
+bool IsInstantEnabled(Profile* profile);
+
// -----------------------------------------------------
// The following APIs are exposed for use in tests only.
// -----------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698