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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchNetworkCommunicator.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.contextualsearch;
6
7 import java.net.URL;
8
9 import javax.annotation.Nullable;
10
11
12 /**
13 * An interface for network communication between the Contextual Search client a nd server.
14 */
15 public interface ContextualSearchNetworkCommunicator {
16
17 /**
18 * Starts a Search Term Resolution request.
19 * When the response comes back {@link #handleSearchTermResolutionResponse} will be called.
20 * @param selection the current selected text.
21 */
22 void startSearchTermResolutionRequest(String selection);
23
24 /**
25 * Continues a Search Term Resolution request using an existing context.
26 * The context for the request must be previously set up through an implemen tation of this
27 * interface (not covered here).
28 * When the response comes back {@link #handleSearchTermResolutionResponse} will be called.
29 */
30 void continueSearchTermResolutionRequest();
31
32 /**
33 * Handles a Search Term Resolution response.
34 * @param isNetworkUnavailable whether the network is available.
35 * @param responseCode the server's HTTP response code.
36 * @param searchTerm the term to search for.
37 * @param displayText the text to display that describes the search term.
38 * @param alternateTerm the alternate search term.
39 * @param doPreventPreload whether to prevent preloading the search result.
40 */
41 void handleSearchTermResolutionResponse(boolean isNetworkUnavailable, int re sponseCode,
42 String searchTerm, String displayText, String alternateTerm, boolean doPreventPreload);
43
44 /**
45 * Loads a URL in the search content view.
46 * @param url the URL of the page to load.
47 */
48 void loadUrl(String url);
49
50 // ------------------------------------------------------------------------- -------------------
51 // These are non-network actions that need to be stubbed out for testing.
52 // ------------------------------------------------------------------------- -------------------
53
54 /**
55 * Gets the URL of the base page.
56 * TODO(donnd): move to another interface, or rename this interface:
57 * This is needed to stub out for testing, but has nothing to do with networ king.
58 * @return The URL of the base page (needed for testing purposes).
59 */
60 @Nullable URL getBasePageUrl();
61
62 /**
63 * Handles the WebContentsObserver#didNavigateMainFrame callback.
64 * @param url The URL of the navigation.
65 * @param httpResultCode The HTTP result code of the navigation.
66 */
67 void handleDidNavigateMainFrame(String url, int httpResultCode);
68
69 /**
70 * Creates and sets up a new Search Panel's {@code ContentViewCore}. If ther e's an existing
71 * {@code ContentViewCore} being used, it will be destroyed first. This shou ld be called as
72 * late as possible to avoid unnecessarily consuming memory.
73 */
74 void createNewSearchContentView();
75
76 /**
77 * Destroys the Search Panel's {@code ContentViewCore}.
78 */
79 void destroySearchContentView();
80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698