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

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: Fix a few more style nits Created 8 years, 3 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..a022de6e9f6f0b18c21c0931ffcfa150f33279e1 100644
--- a/chrome/browser/instant/instant_controller.h
+++ b/chrome/browser/instant/instant_controller.h
@@ -50,32 +50,48 @@ class InstantController : public InstantLoaderDelegate {
static const int kInlineAutocompleteFadeInTimeMS = 300;
// InstantController may operate in one of these modes:
- // INSTANT: The default search engine is preloaded when the omnibox gets
+ // EXTENDED: 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.
+ // inline autocompleted into the omnibox. Previews of search results
+ // as well as predicted URLs are shown. Search suggestions are rendered
+ // within the search results preview.
+ // INSTANT: Same as EXTENDED, without URL previews. Search suggestions are
+ // rendered by the omnibox drop down, and not by the preview page.
// SUGGEST: Same as INSTANT, without visible previews.
// 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 profile object need not
+ // live beyond this call. ***NOTE***: May return NULL, which means that
+ // Instant is disabled in this profile.
+ 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 +171,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,
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698