| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/omnibox/browser/search_provider.h" | 5 #include "components/omnibox/browser/search_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 AutocompleteMatch* match); | 185 AutocompleteMatch* match); |
| 186 | 186 |
| 187 // Looks for a match in |provider_| with destination |url|. Sets |match| to | 187 // Looks for a match in |provider_| with destination |url|. Sets |match| to |
| 188 // it if found. Returns whether |match| was set. | 188 // it if found. Returns whether |match| was set. |
| 189 bool FindMatchWithDestination(const GURL& url, AutocompleteMatch* match); | 189 bool FindMatchWithDestination(const GURL& url, AutocompleteMatch* match); |
| 190 | 190 |
| 191 // AutocompleteProviderListener: | 191 // AutocompleteProviderListener: |
| 192 // If we're waiting for the provider to finish, this exits the message loop. | 192 // If we're waiting for the provider to finish, this exits the message loop. |
| 193 void OnProviderUpdate(bool updated_matches) override; | 193 void OnProviderUpdate(bool updated_matches) override; |
| 194 | 194 |
| 195 // Runs a nested message loop until provider_ is done. The message loop is | 195 // Runs a nested run loop until provider_ is done. The message loop is |
| 196 // exited by way of OnProviderUpdate. | 196 // exited by way of OnProviderUpdate. |
| 197 void RunTillProviderDone(); | 197 void RunTillProviderDone(); |
| 198 | 198 |
| 199 // Invokes Start on provider_, then runs all pending tasks. | 199 // Invokes Start on provider_, then runs all pending tasks. |
| 200 void QueryForInput(const base::string16& text, | 200 void QueryForInput(const base::string16& text, |
| 201 bool prevent_inline_autocomplete, | 201 bool prevent_inline_autocomplete, |
| 202 bool prefer_keyword); | 202 bool prefer_keyword); |
| 203 | 203 |
| 204 // Calls QueryForInput(), finishes any suggest query, then if |wyt_match| is | 204 // Calls QueryForInput(), finishes any suggest query, then if |wyt_match| is |
| 205 // non-NULL, sets it to the "what you typed" entry for |text|. | 205 // non-NULL, sets it to the "what you typed" entry for |text|. |
| (...skipping 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 EXPECT_TRUE(fetcher); | 3637 EXPECT_TRUE(fetcher); |
| 3638 // Even if the fetcher returns results, we should still have no suggestions | 3638 // Even if the fetcher returns results, we should still have no suggestions |
| 3639 // (though the provider should now be done). | 3639 // (though the provider should now be done). |
| 3640 fetcher->set_response_code(200); | 3640 fetcher->set_response_code(200); |
| 3641 fetcher->SetResponseString(R"(["",["a", "b"],[],[],{}])"); | 3641 fetcher->SetResponseString(R"(["",["a", "b"],[],[],{}])"); |
| 3642 fetcher->delegate()->OnURLFetchComplete(fetcher); | 3642 fetcher->delegate()->OnURLFetchComplete(fetcher); |
| 3643 RunTillProviderDone(); | 3643 RunTillProviderDone(); |
| 3644 EXPECT_TRUE(provider_->done()); | 3644 EXPECT_TRUE(provider_->done()); |
| 3645 EXPECT_TRUE(provider_->matches().empty()); | 3645 EXPECT_TRUE(provider_->matches().empty()); |
| 3646 } | 3646 } |
| OLD | NEW |