OSDN Git Service

merge from open-source master
authorThe Android Open Source Project <initial-contribution@android.com>
Tue, 4 May 2010 00:23:01 +0000 (17:23 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Tue, 4 May 2010 00:23:01 +0000 (17:23 -0700)
Change-Id: I5dbf9446b7d4409ec843ee800c82ec06bda7c8db

1  2 
src/com/android/browser/BrowserBackupAgent.java
src/com/android/browser/ErrorConsoleView.java
src/com/android/browser/WebsiteSettingsActivity.java

@@@ -230,10 -228,10 +230,10 @@@ import java.util.Vector
           * This class is an adapter for ErrorConsoleListView that contains the error console
           * message data.
           */
-         private class ErrorConsoleMessageList extends android.widget.BaseAdapter
+         private static class ErrorConsoleMessageList extends android.widget.BaseAdapter
                  implements android.widget.ListAdapter {
  
 -            private Vector<ErrorConsoleMessage> mMessages;
 +            private Vector<ConsoleMessage> mMessages;
              private LayoutInflater mInflater;
  
              public ErrorConsoleMessageList(Context context) {
@@@ -266,43 -262,35 +266,44 @@@ public class WebsiteSettingsActivity ex
                      new String[] { Browser.BookmarkColumns.URL, Browser.BookmarkColumns.TITLE,
                      Browser.BookmarkColumns.FAVICON }, "bookmark = 1", null, null);
  
-             if ((c != null) && c.moveToFirst()) {
-                 int urlIndex = c.getColumnIndex(Browser.BookmarkColumns.URL);
-                 int titleIndex = c.getColumnIndex(Browser.BookmarkColumns.TITLE);
-                 int faviconIndex = c.getColumnIndex(Browser.BookmarkColumns.FAVICON);
-                 do {
-                     String url = c.getString(urlIndex);
-                     String host = Uri.parse(url).getHost();
-                     if (hosts.containsKey(host)) {
-                         String title = c.getString(titleIndex);
-                         Bitmap bmp = null;
-                         byte[] data = c.getBlob(faviconIndex);
-                         if (data != null) {
-                             bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
-                         }
-                         Set matchingSites = (Set) hosts.get(host);
-                         Iterator<Site> sitesIter = matchingSites.iterator();
-                         while (sitesIter.hasNext()) {
-                             Site site = sitesIter.next();
-                             // We should only set the title if the bookmark is for the root
-                             // (i.e. www.google.com), as website settings act on the origin
-                             // as a whole rather than a single page under that origin. If the
-                             // user has bookmarked a page under the root but *not* the root,
-                             // then we risk displaying the title of that page which may or
-                             // may not have any relevance to the origin.
-                             if (url.equals(site.getOrigin()) ||
-                                     (new String(site.getOrigin()+"/")).equals(url)) {
-                                 site.setTitle(title);
+             if (c != null) {
 -                if(c.moveToFirst()) {
++                if (c.moveToFirst()) {
+                     int urlIndex = c.getColumnIndex(Browser.BookmarkColumns.URL);
+                     int titleIndex = c.getColumnIndex(Browser.BookmarkColumns.TITLE);
+                     int faviconIndex = c.getColumnIndex(Browser.BookmarkColumns.FAVICON);
+                     do {
+                         String url = c.getString(urlIndex);
+                         String host = Uri.parse(url).getHost();
+                         if (hosts.containsKey(host)) {
+                             String title = c.getString(titleIndex);
+                             Bitmap bmp = null;
+                             byte[] data = c.getBlob(faviconIndex);
+                             if (data != null) {
+                                 bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
                              }
-                             if (bmp != null) {
-                                 site.setIcon(bmp);
 -                            Set matchingSites = (Set)hosts.get(host);
++                            Set matchingSites = (Set) hosts.get(host);
+                             Iterator<Site> sitesIter = matchingSites.iterator();
+                             while (sitesIter.hasNext()) {
+                                 Site site = sitesIter.next();
 -                                site.setTitle(title);
++                                // We should only set the title if the bookmark is for the root
++                                // (i.e. www.google.com), as website settings act on the origin
++                                // as a whole rather than a single page under that origin. If the
++                                // user has bookmarked a page under the root but *not* the root,
++                                // then we risk displaying the title of that page which may or
++                                // may not have any relevance to the origin.
++                                if (url.equals(site.getOrigin()) ||
++                                        (new String(site.getOrigin()+"/")).equals(url)) {
++                                    site.setTitle(title);
++                                }
+                                 if (bmp != null) {
+                                     site.setIcon(bmp);
+                                 }
                              }
                          }
-                     }
-                 } while (c.moveToNext());
+                     } while (c.moveToNext());
+                 }
+                 c.close();
              }
-             c.close();
          }