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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/HttpRequest.java

Issue 1427663004: Use BitmapHttpRequest to fetch favicon for Nearby URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip (taking changes from dfalcantara,dvh) Created 5 years, 1 month 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/physicalweb/JsonObjectHttpRequest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 package org.chromium.chrome.browser.physicalweb; 4 package org.chromium.chrome.browser.physicalweb;
5 5
6 import org.chromium.base.ThreadUtils; 6 import org.chromium.base.ThreadUtils;
7 7
8 import java.io.BufferedInputStream; 8 import java.io.BufferedInputStream;
9 import java.io.IOException; 9 import java.io.IOException;
10 import java.io.InputStream; 10 import java.io.InputStream;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Setup some values 63 // Setup some values
64 HttpURLConnection urlConnection = null; 64 HttpURLConnection urlConnection = null;
65 T result = null; 65 T result = null;
66 InputStream inputStream = null; 66 InputStream inputStream = null;
67 int responseCode = 0; 67 int responseCode = 0;
68 IOException ioException = null; 68 IOException ioException = null;
69 69
70 // Make the request 70 // Make the request
71 try { 71 try {
72 urlConnection = (HttpURLConnection) mUrl.openConnection(); 72 urlConnection = (HttpURLConnection) mUrl.openConnection();
73 urlConnection.setDoOutput(true);
74 writeToUrlConnection(urlConnection); 73 writeToUrlConnection(urlConnection);
75 responseCode = urlConnection.getResponseCode(); 74 responseCode = urlConnection.getResponseCode();
76 inputStream = new BufferedInputStream(urlConnection.getInputStream() ); 75 inputStream = new BufferedInputStream(urlConnection.getInputStream() );
77 result = readInputStream(inputStream); 76 result = readInputStream(inputStream);
78 } catch (IOException e) { 77 } catch (IOException e) {
79 ioException = e; 78 ioException = e;
80 } finally { 79 } finally {
81 if (urlConnection != null) { 80 if (urlConnection != null) {
82 urlConnection.disconnect(); 81 urlConnection.disconnect();
83 } 82 }
(...skipping 24 matching lines...) Expand all
108 throws IOException; 107 throws IOException;
109 108
110 /** 109 /**
111 * Helper method to read an HTTP response. 110 * Helper method to read an HTTP response.
112 * @param is The InputStream. 111 * @param is The InputStream.
113 * @return An object representing the HTTP response. 112 * @return An object representing the HTTP response.
114 * @throws IOException on error 113 * @throws IOException on error
115 */ 114 */
116 protected abstract T readInputStream(InputStream is) throws IOException; 115 protected abstract T readInputStream(InputStream is) throws IOException;
117 } 116 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/physicalweb/JsonObjectHttpRequest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698