OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.preferences; |
| 6 |
| 7 import android.view.MenuItem; |
| 8 |
| 9 import com.google.android.apps.chrome.R; |
| 10 |
| 11 import org.chromium.base.library_loader.ProcessInitException; |
| 12 import org.chromium.chrome.browser.ChromiumApplication; |
| 13 import org.chromium.chrome.browser.EmbedContentViewActivity; |
| 14 import org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial; |
| 15 import org.chromium.chrome.browser.contextualsearch.ContextualSearchUma; |
| 16 import org.chromium.chrome.browser.help.HelpAndFeedback; |
| 17 import org.chromium.chrome.browser.precache.PrecacheLauncher; |
| 18 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager
; |
| 19 |
| 20 /** |
| 21 * The staging bits of the Chrome settings activity. |
| 22 * |
| 23 * TODO(newt): merge this with Preferences after upstreaming. |
| 24 */ |
| 25 public class PreferencesStaging extends Preferences { |
| 26 |
| 27 @Override |
| 28 protected void startBrowserProcessSync() throws ProcessInitException { |
| 29 ((ChromiumApplication) getApplication()) |
| 30 .startBrowserProcessesAndLoadLibrariesSync(this, true); |
| 31 } |
| 32 |
| 33 @Override |
| 34 protected String getTopLevelFragmentName() { |
| 35 return MainPreferences.class.getName(); |
| 36 } |
| 37 |
| 38 @Override |
| 39 public void showUrl(int titleResId, int urlResId) { |
| 40 EmbedContentViewActivity.show(this, titleResId, urlResId); |
| 41 } |
| 42 |
| 43 @Override |
| 44 public void showGoogleTranslateHelp() { |
| 45 HelpAndFeedback.getInstance(this).show(this, HelpAndFeedback.CONTEXT_TRA
NSLATE, null, null); |
| 46 } |
| 47 |
| 48 @Override |
| 49 public void logContextualSearchToggled(boolean newValue) { |
| 50 ContextualSearchUma.logPreferenceChange(newValue); |
| 51 } |
| 52 |
| 53 @Override |
| 54 public boolean isContextualSearchEnabled() { |
| 55 return ContextualSearchFieldTrial.isEnabled(this); |
| 56 } |
| 57 |
| 58 @Override |
| 59 public void updatePrecachingEnabled() { |
| 60 PrecacheLauncher.updatePrecachingEnabled(PrivacyPreferencesManager.getIn
stance(this), this); |
| 61 } |
| 62 |
| 63 @Override |
| 64 public void showPrivacyPreferencesHelp() { |
| 65 HelpAndFeedback.getInstance(this).show(this, HelpAndFeedback.CONTEXT_PRI
VACY, null, null); |
| 66 } |
| 67 |
| 68 @Override |
| 69 protected void onPause() { |
| 70 super.onPause(); |
| 71 ChromiumApplication.flushPersistentData(); |
| 72 } |
| 73 |
| 74 @Override |
| 75 public boolean onOptionsItemSelected(MenuItem item) { |
| 76 if (item.getItemId() == R.id.menu_id_help_general) { |
| 77 HelpAndFeedback.getInstance(this).show(this, HelpAndFeedback.CONTEXT
_SETTINGS, null, |
| 78 null); |
| 79 return true; |
| 80 } |
| 81 return super.onOptionsItemSelected(item); |
| 82 } |
| 83 |
| 84 } |
OLD | NEW |