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

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

Issue 2768023002: Move remaining @CalledByNative methods out of ChromeApplication. (Closed)
Patch Set: Use DISALLOW_IMPLICIT_CONSTRUCTORS instead of DISALLOW_COPY_AND_ASSIGN 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.preferences; 5 package org.chromium.chrome.browser.preferences;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 10
11 import org.chromium.base.ContextUtils; 11 import org.chromium.base.ContextUtils;
12 import org.chromium.base.Log;
12 import org.chromium.base.annotations.CalledByNative; 13 import org.chromium.base.annotations.CalledByNative;
13 import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPrefe rences; 14 import org.chromium.chrome.browser.preferences.autofill.AutofillAndPaymentsPrefe rences;
15 import org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences ;
14 import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataPreferen ces; 16 import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataPreferen ces;
15 import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataTabsFrag ment; 17 import org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataTabsFrag ment;
18 import org.chromium.chrome.browser.tab.Tab;
16 19
17 /** 20 /**
18 * A utility class for launching Chrome Settings. 21 * A utility class for launching Chrome Settings.
19 */ 22 */
20 public class PreferencesLauncher { 23 public class PreferencesLauncher {
24 private static final String TAG = "PreferencesLauncher";
21 25
22 /** 26 /**
23 * Launches settings, either on the top-level page or on a subpage. 27 * Launches settings, either on the top-level page or on a subpage.
24 * 28 *
25 * @param context The current Activity, or an application context if no Acti vity is available. 29 * @param context The current Activity, or an application context if no Acti vity is available.
26 * @param fragmentName The name of the fragment to show, or null to show the top-level page. 30 * @param fragmentName The name of the fragment to show, or null to show the top-level page.
27 */ 31 */
28 public static void launchSettingsPage(Context context, String fragmentName) { 32 public static void launchSettingsPage(Context context, String fragmentName) {
29 Intent intent = createIntentForSettingsPage(context, fragmentName); 33 Intent intent = createIntentForSettingsPage(context, fragmentName);
30 context.startActivity(intent); 34 context.startActivity(intent);
(...skipping 30 matching lines...) Expand all
61 ? ClearBrowsingDataTabsFragment.class.getName() 65 ? ClearBrowsingDataTabsFragment.class.getName()
62 : ClearBrowsingDataPreferences.class.getName(); 66 : ClearBrowsingDataPreferences.class.getName();
63 return createIntentForSettingsPage(context, fragmentName); 67 return createIntentForSettingsPage(context, fragmentName);
64 } 68 }
65 69
66 @CalledByNative 70 @CalledByNative
67 private static void showAutofillSettings() { 71 private static void showAutofillSettings() {
68 launchSettingsPage(ContextUtils.getApplicationContext(), 72 launchSettingsPage(ContextUtils.getApplicationContext(),
69 AutofillAndPaymentsPreferences.class.getName()); 73 AutofillAndPaymentsPreferences.class.getName());
70 } 74 }
75
76 @CalledByNative
77 private static void showPasswordSettings() {
78 launchSettingsPage(
79 ContextUtils.getApplicationContext(), SavePasswordsPreferences.c lass.getName());
80 }
81
82 /**
83 * Opens the UI to clear browsing data.
84 * @param tab The tab that triggered the request.
85 */
86 @CalledByNative
87 private static void openClearBrowsingData(Tab tab) {
88 Activity activity = tab.getWindowAndroid().getActivity().get();
89 if (activity == null) {
90 Log.e(TAG, "Attempting to open clear browsing data for a tab without a valid activity");
91 return;
92 }
93
94 Intent intent = createIntentForClearBrowsingDataPage(activity);
95 activity.startActivity(intent);
96 }
71 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698