Bug 762068 - Part 1: Don't save suggest engine to shared prefs. r=mfinkle

--HG--
extra : rebase_source : be93a12b828e25ba40307d211342e376a5faad5d
This commit is contained in:
Brian Nicholson 2012-06-12 10:03:13 -07:00
Родитель eb62d9e524
Коммит 4d37ae35cc
1 изменённых файлов: 1 добавлений и 36 удалений

Просмотреть файл

@ -230,30 +230,12 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
registerForContextMenu(mAwesomeTabs.findViewById(R.id.bookmarks_list));
registerForContextMenu(mAwesomeTabs.findViewById(R.id.history_list));
if (sSuggestTemplate == null) {
loadSuggestClientFromPrefs();
} else {
loadSuggestClient();
}
GeckoAppShell.registerGeckoEventListener("SearchEngines:Data", this);
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
}
private void loadSuggestClientFromPrefs() {
GeckoAppShell.getHandler().post(new Runnable() {
public void run() {
SharedPreferences prefs = getSearchPreferences();
sSuggestEngine = prefs.getString("suggestEngine", null);
sSuggestTemplate = prefs.getString("suggestTemplate", null);
if (sSuggestTemplate != null) {
loadSuggestClient();
mAwesomeTabs.setSuggestEngine(sSuggestEngine, null);
}
}
});
}
private void loadSuggestClient() {
mSuggestClient = new SuggestClient(GeckoApp.mAppContext, sSuggestTemplate, SUGGESTION_TIMEOUT, SUGGESTION_MAX);
}
@ -264,7 +246,6 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
final String suggestEngine = message.optString("suggestEngine");
final String suggestTemplate = message.optString("suggestTemplate");
if (!TextUtils.equals(suggestTemplate, sSuggestTemplate)) {
saveSuggestEngineData(suggestEngine, suggestTemplate);
sSuggestEngine = suggestEngine;
sSuggestTemplate = suggestTemplate;
loadSuggestClient();
@ -277,18 +258,6 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
}
}
private void saveSuggestEngineData(final String suggestEngine, final String suggestTemplate) {
GeckoAppShell.getHandler().post(new Runnable() {
public void run() {
SharedPreferences prefs = getSearchPreferences();
SharedPreferences.Editor editor = prefs.edit();
editor.putString("suggestEngine", suggestEngine);
editor.putString("suggestTemplate", suggestTemplate);
editor.commit();
}
});
}
@Override
public void onConfigurationChanged(Configuration newConfiguration) {
super.onConfigurationChanged(newConfiguration);
@ -766,8 +735,4 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
mOnKeyPreImeListener = listener;
}
}
private SharedPreferences getSearchPreferences() {
return getSharedPreferences("search.prefs", MODE_PRIVATE);
}
}