diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/instant/instant_controller.cc | 21 | ||||
-rw-r--r-- | chrome/browser/instant/instant_controller.h | 5 | ||||
-rw-r--r-- | chrome/browser/instant/instant_page.cc | 3 | ||||
-rw-r--r-- | chrome/browser/instant/instant_page.h | 2 | ||||
-rw-r--r-- | chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js | 3 | ||||
-rw-r--r-- | chrome/common/instant_types.h | 23 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 4 | ||||
-rw-r--r-- | chrome/renderer/resources/extensions/searchbox_api.js | 8 | ||||
-rw-r--r-- | chrome/renderer/searchbox/searchbox.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/searchbox/searchbox.h | 4 | ||||
-rw-r--r-- | chrome/renderer/searchbox/searchbox_extension.cc | 16 | ||||
-rw-r--r-- | chrome/test/data/instant_extended.html | 2 |
12 files changed, 20 insertions, 79 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index f03a1cd..2ac5817 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -1128,15 +1128,14 @@ void InstantController::SetSuggestions( // Extended mode pages will call ShowOverlay() when they are ready. if (!extended_enabled_) - ShowOverlay(INSTANT_SHOWN_QUERY_SUGGESTIONS, 100, INSTANT_SIZE_PERCENT); + ShowOverlay(100, INSTANT_SIZE_PERCENT); } void InstantController::ShowInstantOverlay(const content::WebContents* contents, - InstantShownReason reason, int height, InstantSizeUnits units) { if (extended_enabled_ && IsContentsFrom(overlay(), contents)) - ShowOverlay(reason, height, units); + ShowOverlay(height, units); } void InstantController::FocusOmnibox(const content::WebContents* contents) { @@ -1336,24 +1335,16 @@ void InstantController::HideInternal() { first_interaction_time_ = base::Time(); } -void InstantController::ShowOverlay(InstantShownReason reason, - int height, - InstantSizeUnits units) { +void InstantController::ShowOverlay(int height, InstantSizeUnits units) { // If we are on a committed search results page, the |overlay_| is not in use. if (instant_tab_) return; LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( - "Show: reason=%d height=%d units=%d", reason, height, units)); - - // INSTANT_SHOWN_CUSTOM_NTP_CONTENT is no longer supported. - // TODO(samarth): remove once the server has been updated. - if (reason == INSTANT_SHOWN_CUSTOM_NTP_CONTENT) - return; + "Show: height=%d units=%d", height, units)); // Must have updated omnibox after the last HideOverlay() to show suggestions. - if (reason == INSTANT_SHOWN_QUERY_SUGGESTIONS && - !allow_overlay_to_show_search_suggestions_) + if (!allow_overlay_to_show_search_suggestions_) return; // The page is trying to hide itself. Hide explicitly (i.e., don't use @@ -1373,11 +1364,9 @@ void InstantController::ShowOverlay(InstantShownReason reason, // Show at 100% height except in the following cases: // - The local overlay (omnibox popup) is being loaded. // - Instant is disabled. The page needs to be able to show only a dropdown. - // - The page wants to show custom NTP content. // - The page is over a website other than search or an NTP, and is not // already showing at 100% height. if (overlay_->IsUsingLocalOverlay() || !instant_enabled_ || - reason == INSTANT_SHOWN_CUSTOM_NTP_CONTENT || (search_mode_.is_origin_default() && !IsFullHeight(model_))) model_.SetOverlayState(search_mode_, height, units); else diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h index 094a2ee..ef32619 100644 --- a/chrome/browser/instant/instant_controller.h +++ b/chrome/browser/instant/instant_controller.h @@ -242,7 +242,6 @@ class InstantController : public InstantPage::Delegate, const std::vector<InstantSuggestion>& suggestions) OVERRIDE; virtual void ShowInstantOverlay( const content::WebContents* contents, - InstantShownReason reason, int height, InstantSizeUnits units) OVERRIDE; virtual void FocusOmnibox(const content::WebContents* contents) OVERRIDE; @@ -305,9 +304,7 @@ class InstantController : public InstantPage::Delegate, // Counterpart to HideOverlay(). Asks the |browser_| to display the overlay // with the given |height| in |units|. - void ShowOverlay(InstantShownReason reason, - int height, - InstantSizeUnits units); + void ShowOverlay(int height, InstantSizeUnits units); // Send the omnibox popup bounds to the page. void SendPopupBoundsToPage(); diff --git a/chrome/browser/instant/instant_page.cc b/chrome/browser/instant/instant_page.cc index c89521d..cbb0390 100644 --- a/chrome/browser/instant/instant_page.cc +++ b/chrome/browser/instant/instant_page.cc @@ -225,13 +225,12 @@ void InstantPage::OnInstantSupportDetermined(int page_id, } void InstantPage::OnShowInstantOverlay(int page_id, - InstantShownReason reason, int height, InstantSizeUnits units) { if (contents()->IsActiveEntry(page_id)) { OnInstantSupportDetermined(page_id, true); if (ShouldProcessShowInstantOverlay()) - delegate_->ShowInstantOverlay(contents(), reason, height, units); + delegate_->ShowInstantOverlay(contents(), height, units); } } diff --git a/chrome/browser/instant/instant_page.h b/chrome/browser/instant/instant_page.h index 15c8fe4..5361d65 100644 --- a/chrome/browser/instant/instant_page.h +++ b/chrome/browser/instant/instant_page.h @@ -62,7 +62,6 @@ class InstantPage : public content::WebContentsObserver { // Called when the page wants to be shown. Usually in response to Update() // or SendAutocompleteResults(). virtual void ShowInstantOverlay(const content::WebContents* contents, - InstantShownReason reason, int height, InstantSizeUnits units) = 0; @@ -218,7 +217,6 @@ class InstantPage : public content::WebContentsObserver { const std::vector<InstantSuggestion>& suggestions); void OnInstantSupportDetermined(int page_id, bool supports_instant); void OnShowInstantOverlay(int page_id, - InstantShownReason reason, int height, InstantSizeUnits units); void OnFocusOmnibox(int page_id); diff --git a/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js b/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js index e07c9e9..97adfd2 100644 --- a/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js +++ b/chrome/browser/resources/local_omnibox_popup/local_omnibox_popup.js @@ -205,8 +205,7 @@ function handleNativeSuggestions() { } var height = getDropdownHeight(); - // TODO(jered): Remove deprecated "reason" argument. - apiHandle.showOverlay(2, height); + apiHandle.showOverlay(height); } /** diff --git a/chrome/common/instant_types.h b/chrome/common/instant_types.h index ca7424e..aa9c271 100644 --- a/chrome/common/instant_types.h +++ b/chrome/common/instant_types.h @@ -90,29 +90,6 @@ enum InstantSizeUnits { INSTANT_SIZE_PERCENT, }; -// What the Instant page contains when it requests to be shown. -// TODO(jered): Delete this. -enum InstantShownReason { - // Contents are not specified; the page wants to be shown unconditionally. - // This is a stopgap to display in unexpected situations, and should not - // normally be used. - INSTANT_SHOWN_NOT_SPECIFIED, - - // Custom content on the NTP, e.g. a custom logo. - INSTANT_SHOWN_CUSTOM_NTP_CONTENT, - - // Query suggestions and search results relevant when the user is typing in - // the omnibox. - INSTANT_SHOWN_QUERY_SUGGESTIONS, - - // ZeroSuggest suggestions relevant when the user has focused in the omnibox, - // but not yet typed anything. - INSTANT_SHOWN_ZERO_SUGGESTIONS, - - // Search results in response to the user clicking a query suggestion. - INSTANT_SHOWN_CLICKED_QUERY_SUGGESTION, -}; - // The alignment of the theme background image. enum ThemeBackgroundImageAlignment { THEME_BKGRND_IMAGE_ALIGN_CENTER, diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 6effad2..bdc6beb 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -118,7 +118,6 @@ IPC_ENUM_TRAITS(ChromeViewHostMsg_GetPluginInfo_Status::Value) IPC_ENUM_TRAITS(InstantCompleteBehavior) IPC_ENUM_TRAITS(InstantSizeUnits) IPC_ENUM_TRAITS(InstantSuggestionType) -IPC_ENUM_TRAITS(InstantShownReason) IPC_ENUM_TRAITS(search_provider::OSDDType) IPC_ENUM_TRAITS(search_provider::InstallState) IPC_ENUM_TRAITS(ThemeBackgroundImageAlignment) @@ -690,9 +689,8 @@ IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_SearchBoxNavigate, WindowOpenDisposition /* disposition */) // Sent by the Instant overlay asking to show itself with the given height. -IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_ShowInstantOverlay, +IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_ShowInstantOverlay, int /* page_id */, - InstantShownReason /* reason */, int /* height */, InstantSizeUnits /* units */) diff --git a/chrome/renderer/resources/extensions/searchbox_api.js b/chrome/renderer/resources/extensions/searchbox_api.js index 6c7512c..f93a54c 100644 --- a/chrome/renderer/resources/extensions/searchbox_api.js +++ b/chrome/renderer/resources/extensions/searchbox_api.js @@ -252,12 +252,9 @@ if (!chrome.embeddedSearch) { this.setRestrictedValue = function(autocompleteResultId) { SetQueryFromAutocompleteResult(autocompleteResultId); }; - // TODO(jered): Remove the deprecated "reason" argument. - this.showOverlay = function(reason, height) { - ShowOverlay(reason, height); + this.showOverlay = function(height) { + ShowOverlay(height); }; - // TODO(jered): Remove this when GWS knows about showOverlay(). - this.show = this.showOverlay; this.markDuplicateSuggestions = function(clientSuggestions) { return DedupeClientSuggestions(clientSuggestions); }; @@ -279,7 +276,6 @@ if (!chrome.embeddedSearch) { this.onresize = null; this.onkeypress = null; this.onkeycapturechange = null; - this.oncontextchange = null; this.onmarginchange = null; this.onnativesuggestions = null; diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc index bbdfee1..fda2c68 100644 --- a/chrome/renderer/searchbox/searchbox.cc +++ b/chrome/renderer/searchbox/searchbox.cc @@ -46,12 +46,10 @@ void SearchBox::ClearQuery() { query_.clear(); } -void SearchBox::ShowInstantOverlay(InstantShownReason reason, - int height, - InstantSizeUnits units) { +void SearchBox::ShowInstantOverlay(int height, InstantSizeUnits units) { render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( - render_view()->GetRoutingID(), render_view()->GetPageId(), reason, - height, units)); + render_view()->GetRoutingID(), render_view()->GetPageId(), height, + units)); } void SearchBox::FocusOmnibox() { diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h index 7e86edb..cd94f0c 100644 --- a/chrome/renderer/searchbox/searchbox.h +++ b/chrome/renderer/searchbox/searchbox.h @@ -35,9 +35,7 @@ class SearchBox : public content::RenderViewObserver, void ClearQuery(); // Sends ChromeViewHostMsg_ShowInstantOverlay to the browser. - void ShowInstantOverlay(InstantShownReason reason, - int height, - InstantSizeUnits units); + void ShowInstantOverlay(int height, InstantSizeUnits units); // Sends ChromeViewHostMsg_FocusOmnibox to the browser. void FocusOmnibox(); diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 148a728..9f5126d 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc @@ -949,25 +949,17 @@ v8::Handle<v8::Value> v8::Handle<v8::Value> SearchBoxExtensionWrapper::ShowOverlay( const v8::Arguments& args) { content::RenderView* render_view = GetRenderView(); - if (!render_view || args.Length() < 2) return v8::Undefined(); + if (!render_view || args.Length() < 1) return v8::Undefined(); DVLOG(1) << render_view << " ShowOverlay"; - InstantShownReason reason = INSTANT_SHOWN_NOT_SPECIFIED; - switch (args[0]->Uint32Value()) { - case 1: reason = INSTANT_SHOWN_CUSTOM_NTP_CONTENT; break; - case 2: reason = INSTANT_SHOWN_QUERY_SUGGESTIONS; break; - case 3: reason = INSTANT_SHOWN_ZERO_SUGGESTIONS; break; - case 4: reason = INSTANT_SHOWN_CLICKED_QUERY_SUGGESTION; break; - } int height = 100; InstantSizeUnits units = INSTANT_SIZE_PERCENT; - if (args[1]->IsInt32()) { - height = args[1]->Int32Value(); + if (args[0]->IsInt32()) { + height = args[0]->Int32Value(); units = INSTANT_SIZE_PIXELS; } - - SearchBox::Get(render_view)->ShowInstantOverlay(reason, height, units); + SearchBox::Get(render_view)->ShowInstantOverlay(height, units); return v8::Undefined(); } diff --git a/chrome/test/data/instant_extended.html b/chrome/test/data/instant_extended.html index 01d17f0..fb38c3e 100644 --- a/chrome/test/data/instant_extended.html +++ b/chrome/test/data/instant_extended.html @@ -36,7 +36,7 @@ function getNewTabPageHandle() { function handleNativeSuggestions() { onNativeSuggestionsCalls++; // Showing the loader at 100% height. - apiHandle.show(2 /* QUERY_SUGGESTIONS */); + apiHandle.showOverlay(); } function handleSubmit() { |