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

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

Issue 11360207: Add Java resources to content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove obsolete findbugs warnings Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.app.SearchManager; 7 import android.app.SearchManager;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.database.AbstractCursor; 9 import android.database.AbstractCursor;
10 import android.database.Cursor; 10 import android.database.Cursor;
11 import android.provider.BaseColumns; 11 import android.provider.BaseColumns;
12 import android.provider.Browser.BookmarkColumns; 12 import android.provider.Browser.BookmarkColumns;
13 13
14 import org.chromium.content.app.AppResource; 14 import org.chromium.chrome.R;
15 15
16 /** 16 /**
17 * For bookmarks/history suggestions, wrap the cursor returned in one that can f eed 17 * For bookmarks/history suggestions, wrap the cursor returned in one that can f eed
18 * the data back to global search in the format it wants. 18 * the data back to global search in the format it wants.
19 */ 19 */
20 class ChromeBrowserProviderSuggestionsCursor extends AbstractCursor { 20 class ChromeBrowserProviderSuggestionsCursor extends AbstractCursor {
21 21
22 private static final String[] COLS = new String [] { 22 private static final String[] COLS = new String [] {
23 BaseColumns._ID, 23 BaseColumns._ID,
24 SearchManager.SUGGEST_COLUMN_INTENT_ACTION, 24 SearchManager.SUGGEST_COLUMN_INTENT_ACTION,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return Intent.ACTION_VIEW; 64 return Intent.ACTION_VIEW;
65 case COLUMN_SUGGEST_INTENT_DATA: 65 case COLUMN_SUGGEST_INTENT_DATA:
66 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL) ); 66 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL) );
67 case COLUMN_SUGGEST_TEXT_1: 67 case COLUMN_SUGGEST_TEXT_1:
68 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.TITL E)); 68 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.TITL E));
69 case COLUMN_SUGGEST_TEXT_2: 69 case COLUMN_SUGGEST_TEXT_2:
70 case COLUMN_SUGGEST_TEXT_2_URL: 70 case COLUMN_SUGGEST_TEXT_2_URL:
71 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL) ); 71 return mCursor.getString(mCursor.getColumnIndex(BookmarkColumns.URL) );
72 case COLUMN_SUGGEST_ICON_1: 72 case COLUMN_SUGGEST_ICON_1:
73 // This is the icon displayed to the left of the result in QSB. 73 // This is the icon displayed to the left of the result in QSB.
74 assert AppResource.DRAWABLE_ICON_APP_ICON != 0; 74 return Integer.toString(R.mipmap.icon);
75 return Integer.toString(AppResource.DRAWABLE_ICON_APP_ICON);
76 case COLUMN_SUGGEST_LAST_ACCESS_HINT: 75 case COLUMN_SUGGEST_LAST_ACCESS_HINT:
77 // After clearing history, the Chrome bookmarks database will have a last 76 // After clearing history, the Chrome bookmarks database will have a last
78 // access time of 0 for all bookmarks. In the Android provider, this will 77 // access time of 0 for all bookmarks. In the Android provider, this will
79 // yield a negative last access time. A negative last access time wi ll 78 // yield a negative last access time. A negative last access time wi ll
80 // cause global search to discard the result, so fix it up before 79 // cause global search to discard the result, so fix it up before
81 // we return it. 80 // we return it.
82 long lastAccess = mCursor.getLong( 81 long lastAccess = mCursor.getLong(
83 mCursor.getColumnIndex(BookmarkColumns.DATE)); 82 mCursor.getColumnIndex(BookmarkColumns.DATE));
84 return lastAccess < 0 ? "0" : "" + lastAccess; 83 return lastAccess < 0 ? "0" : "" + lastAccess;
85 default: 84 default:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 @Override 122 @Override
124 public float getFloat(int c) { 123 public float getFloat(int c) {
125 throw new UnsupportedOperationException(); 124 throw new UnsupportedOperationException();
126 } 125 }
127 126
128 @Override 127 @Override
129 public boolean onMove(int oldPosition, int newPosition) { 128 public boolean onMove(int oldPosition, int newPosition) {
130 return mCursor.moveToPosition(newPosition); 129 return mCursor.moveToPosition(newPosition);
131 } 130 }
132 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698