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

Unified Diff: chrome/browser/instant/instant_controller.h

Issue 10879043: Centralize logic around Instant modes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renamed to CreateInstant; fixed ordering Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/instant/instant_controller.h
diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h
index 242466731d88fd70a3f9db86afc97537cf8a7324..b1557f8031f847774349355d7f2ce452920006f6 100644
--- a/chrome/browser/instant/instant_controller.h
+++ b/chrome/browser/instant/instant_controller.h
@@ -50,6 +50,8 @@ class InstantController : public InstantLoaderDelegate {
static const int kInlineAutocompleteFadeInTimeMS = 300;
// InstantController may operate in one of these modes:
+ // EXTENDED: Similar to INSTANT, but with extended functionality, such as
Peter Kasting 2012/08/31 01:51:19 Nit: Might make sense to write the full descriptio
sreeram 2012/09/04 17:42:16 Done.
+ // rendering suggestions within the preview and previews of URLs.
// INSTANT: The default search engine is preloaded when the omnibox gets
// focus. Queries are issued as the user types. Predicted queries are
// inline autocompleted into the omnibox. Result previews are shown.
@@ -57,25 +59,37 @@ class InstantController : public InstantLoaderDelegate {
// HIDDEN: Same as SUGGEST, without the inline autocompletion.
// SILENT: Same as HIDDEN, without issuing queries as the user types. The
// query is sent only after the user presses <Enter>.
- // EXTENDED: Similar to INSTANT, but with extended functionality, such as
- // rendering suggestions within the preview and previews of URLs.
+ // DISABLED: Instant is disabled.
enum Mode {
+ EXTENDED,
INSTANT,
SUGGEST,
HIDDEN,
SILENT,
- EXTENDED,
+ DISABLED,
};
- InstantController(InstantControllerDelegate* delegate, Mode mode);
virtual ~InstantController();
+ // Creates a new InstantController. Caller owns the returned object. The
+ // |profile| pointer is not cached, so the underlying object need not live
+ // beyond this call. ***NOTE***: May return NULL, which means that Instant is
+ // disabled in this profile.
Peter Kasting 2012/08/31 01:51:19 Is it legal to call this multiple times on the sam
sreeram 2012/09/04 17:42:16 Yes, it's legal to call it multiple times. I think
+ static InstantController* CreateInstant(Profile* profile,
+ InstantControllerDelegate* delegate);
+
+ // Returns true if Instant is enabled and supports the extended API.
+ static bool IsExtendedAPIEnabled(Profile* profile);
+
+ // Returns true if Instant is enabled in a visible, preview-showing mode.
+ static bool IsInstantEnabled(Profile* profile);
+
+ // Returns true if Instant will provide autocomplete suggestions.
+ static bool IsSuggestEnabled(Profile* profile);
+
// Registers Instant related preferences.
static void RegisterUserPrefs(PrefService* prefs);
- // Returns true if Instant is enabled for the given |profile|.
- static bool IsEnabled(Profile* profile);
-
// Invoked as the user types into the omnibox. |user_text| is what the user
// has typed. |full_text| is what the omnibox is showing. These may differ if
// the user typed only some text, and the rest was inline autocompleted. If
@@ -155,6 +169,8 @@ class InstantController : public InstantLoaderDelegate {
private:
FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh);
+ InstantController(InstantControllerDelegate* delegate, Mode mode);
+
// Creates a new loader if necessary (for example, if the |instant_url| has
// changed since the last time we created the loader).
void ResetLoader(const std::string& instant_url,

Powered by Google App Engine
This is Rietveld 408576698