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

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

Issue 2815103004: Android: convert kEnumName to ENUM_NAME in java_cpp_enum.py. (Closed)
Patch Set: Address agrieve@ comments Created 3 years, 8 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
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 4
5 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 int version = mPreferences.getInt(KEY_VERSION, VERSION_INVALID); 196 int version = mPreferences.getInt(KEY_VERSION, VERSION_INVALID);
197 if (version == VERSION_INVALID) return null; 197 if (version == VERSION_INVALID) return null;
198 198
199 // Use "standalone" as the default display mode as this was the original assumed default for 199 // Use "standalone" as the default display mode as this was the original assumed default for
200 // all web apps. 200 // all web apps.
201 return ShortcutHelper.createWebappShortcutIntent(mId, 201 return ShortcutHelper.createWebappShortcutIntent(mId,
202 mPreferences.getString(KEY_ACTION, null), mPreferences.getString (KEY_URL, null), 202 mPreferences.getString(KEY_ACTION, null), mPreferences.getString (KEY_URL, null),
203 mPreferences.getString(KEY_SCOPE, null), mPreferences.getString( KEY_NAME, null), 203 mPreferences.getString(KEY_SCOPE, null), mPreferences.getString( KEY_NAME, null),
204 mPreferences.getString(KEY_SHORT_NAME, null), 204 mPreferences.getString(KEY_SHORT_NAME, null),
205 ShortcutHelper.decodeBitmapFromString(mPreferences.getString(KEY _ICON, null)), 205 ShortcutHelper.decodeBitmapFromString(mPreferences.getString(KEY _ICON, null)),
206 version, mPreferences.getInt(KEY_DISPLAY_MODE, WebDisplayMode.kS tandalone), 206 version, mPreferences.getInt(KEY_DISPLAY_MODE, WebDisplayMode.ST ANDALONE),
207 mPreferences.getInt(KEY_ORIENTATION, ScreenOrientationValues.DEF AULT), 207 mPreferences.getInt(KEY_ORIENTATION, ScreenOrientationValues.DEF AULT),
208 mPreferences.getLong( 208 mPreferences.getLong(
209 KEY_THEME_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_O R_MISSING), 209 KEY_THEME_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_O R_MISSING),
210 mPreferences.getLong( 210 mPreferences.getLong(
211 KEY_BACKGROUND_COLOR, ShortcutHelper.MANIFEST_COLOR_INVA LID_OR_MISSING), 211 KEY_BACKGROUND_COLOR, ShortcutHelper.MANIFEST_COLOR_INVA LID_OR_MISSING),
212 mPreferences.getBoolean(KEY_IS_ICON_GENERATED, false)); 212 mPreferences.getBoolean(KEY_IS_ICON_GENERATED, false));
213 } 213 }
214 214
215 /** 215 /**
216 * Updates the data stored in this object to match that in the supplied inte nt. 216 * Updates the data stored in this object to match that in the supplied inte nt.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 shortcutIntent, ShortcutHelper.EXTRA_NAME)); 251 shortcutIntent, ShortcutHelper.EXTRA_NAME));
252 editor.putString(KEY_SHORT_NAME, IntentUtils.safeGetStringExtra( 252 editor.putString(KEY_SHORT_NAME, IntentUtils.safeGetStringExtra(
253 shortcutIntent, ShortcutHelper.EXTRA_SHORT_NAME)); 253 shortcutIntent, ShortcutHelper.EXTRA_SHORT_NAME));
254 editor.putString(KEY_ICON, IntentUtils.safeGetStringExtra( 254 editor.putString(KEY_ICON, IntentUtils.safeGetStringExtra(
255 shortcutIntent, ShortcutHelper.EXTRA_ICON)); 255 shortcutIntent, ShortcutHelper.EXTRA_ICON));
256 editor.putInt(KEY_VERSION, ShortcutHelper.WEBAPP_SHORTCUT_VERSION); 256 editor.putInt(KEY_VERSION, ShortcutHelper.WEBAPP_SHORTCUT_VERSION);
257 257
258 // "Standalone" was the original assumed default for all web apps. 258 // "Standalone" was the original assumed default for all web apps.
259 editor.putInt(KEY_DISPLAY_MODE, 259 editor.putInt(KEY_DISPLAY_MODE,
260 IntentUtils.safeGetIntExtra(shortcutIntent, ShortcutHelper.E XTRA_DISPLAY_MODE, 260 IntentUtils.safeGetIntExtra(shortcutIntent, ShortcutHelper.E XTRA_DISPLAY_MODE,
261 WebDisplayMode.kStandalone)); 261 WebDisplayMode.STANDALONE));
262 editor.putInt(KEY_ORIENTATION, IntentUtils.safeGetIntExtra( 262 editor.putInt(KEY_ORIENTATION, IntentUtils.safeGetIntExtra(
263 shortcutIntent, ShortcutHelper.EXTRA_ORIENTATION, 263 shortcutIntent, ShortcutHelper.EXTRA_ORIENTATION,
264 ScreenOrientationValues.DEFAULT)); 264 ScreenOrientationValues.DEFAULT));
265 editor.putLong(KEY_THEME_COLOR, IntentUtils.safeGetLongExtra( 265 editor.putLong(KEY_THEME_COLOR, IntentUtils.safeGetLongExtra(
266 shortcutIntent, ShortcutHelper.EXTRA_THEME_COLOR, 266 shortcutIntent, ShortcutHelper.EXTRA_THEME_COLOR,
267 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING)); 267 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING));
268 editor.putLong(KEY_BACKGROUND_COLOR, IntentUtils.safeGetLongExtra( 268 editor.putLong(KEY_BACKGROUND_COLOR, IntentUtils.safeGetLongExtra(
269 shortcutIntent, ShortcutHelper.EXTRA_BACKGROUND_COLOR, 269 shortcutIntent, ShortcutHelper.EXTRA_BACKGROUND_COLOR,
270 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING)); 270 ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING));
271 editor.putBoolean(KEY_IS_ICON_GENERATED, IntentUtils.safeGetBooleanE xtra( 271 editor.putBoolean(KEY_IS_ICON_GENERATED, IntentUtils.safeGetBooleanE xtra(
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 protected WebappDataStorage(String webappId) { 474 protected WebappDataStorage(String webappId) {
475 mId = webappId; 475 mId = webappId;
476 mPreferences = ContextUtils.getApplicationContext().getSharedPreferences ( 476 mPreferences = ContextUtils.getApplicationContext().getSharedPreferences (
477 SHARED_PREFS_FILE_PREFIX + webappId, Context.MODE_PRIVATE); 477 SHARED_PREFS_FILE_PREFIX + webappId, Context.MODE_PRIVATE);
478 } 478 }
479 479
480 private boolean isEmpty() { 480 private boolean isEmpty() {
481 return mPreferences.getAll().isEmpty(); 481 return mPreferences.getAll().isEmpty();
482 } 482 }
483 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698