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

Unified Diff: chrome/common/instant_types.h

Issue 10809063: Adding Javascript support for the Extended Searchbox API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressing sky's comments. Created 8 years, 5 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
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/instant_types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/instant_types.h
diff --git a/chrome/common/instant_types.h b/chrome/common/instant_types.h
index 46638f92b879eed307eddf7950f174b7638b51ed..57212a5b7186b3db4b6a030c295be64c52613f93 100644
--- a/chrome/common/instant_types.h
+++ b/chrome/common/instant_types.h
@@ -1,20 +1,83 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 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.
#ifndef CHROME_COMMON_INSTANT_TYPES_H_
#define CHROME_COMMON_INSTANT_TYPES_H_
-// Enum describing the ways instant suggest text can be completed.
+#include <string>
+
+#include "googleurl/src/gurl.h"
+
+// Ways that the Instant suggested text is autocompleted into the omnibox.
enum InstantCompleteBehavior {
- // Complete the suggestion now.
+ // Autocomplete the suggestion immediately.
INSTANT_COMPLETE_NOW,
- // Complete the suggestion after a delay.
+ // Autocomplete the suggestion after a delay.
INSTANT_COMPLETE_DELAYED,
- // Never complete the suggestion.
- INSTANT_COMPLETE_NEVER
+ // Do not autocomplete the suggestion. The suggestion may still be displayed
+ // in the omnibox, but not made a part of the omnibox text by default (e.g.,
+ // by displaying the suggestion as non-highlighted, non-selected gray text).
+ INSTANT_COMPLETE_NEVER,
+
+ // Treat the suggested text as the entire omnibox text, effectively replacing
+ // whatever the user has typed.
+ INSTANT_COMPLETE_REPLACE,
+};
+
+// The type of suggestion provided by Instant. For example, if Instant suggests
+// "yahoo.com", should that be considered a search string or a URL?
+enum InstantSuggestionType {
+ INSTANT_SUGGESTION_SEARCH,
+ INSTANT_SUGGESTION_URL,
+};
+
+// A wrapper to hold Instant suggested text and its metadata such as the type
+// of the suggestion and what completion behavior should be applied to it.
+struct InstantSuggestion {
+ InstantSuggestion();
+ InstantSuggestion(const std::string& text,
+ InstantCompleteBehavior behavior,
+ InstantSuggestionType type);
+ ~InstantSuggestion();
+
+ std::string text;
+ InstantCompleteBehavior behavior;
+ InstantSuggestionType type;
+};
+
+// Omnibox dropdown matches provided by the native autocomplete providers.
+struct InstantNativeSuggestionsParts {
sky 2012/07/24 23:00:23 'native' is a bit confusing here. I think this sho
Shishir 2012/07/24 23:28:07 The naming is to be consistent with the JS API: On
sreeram 2012/07/25 17:48:23 I agree that "native" is confusing. When I first j
+ InstantNativeSuggestionsParts();
+ ~InstantNativeSuggestionsParts();
+
+ // The provider name. May be empty.
+ std::string provider;
+
+ // True iff this is a search suggestion.
+ bool is_search;
+
+ // The title of the match.
+ std::string contents;
+
+ // The URL of the match.
+ // TODO(dhollowa): Remove this once the privacy story is sorted out.
+ GURL destination_url;
+
+ // The relevance score of this match. Same as the relevance score stored in
+ // AutocompleteMatch.
+ int relevance;
+};
+
+// How to interpret the size (height or width) of the Instant overlay (preview).
+enum InstantSizeUnits {
+ // As an absolute number of pixels.
+ INSTANT_SIZE_PIXELS,
+
+ // As a percentage of the height or width of the containing (parent) view.
+ INSTANT_SIZE_PERCENT,
};
#endif // CHROME_COMMON_INSTANT_TYPES_H_
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/instant_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698