| OLD | NEW |
| 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.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Fragment; | 8 import android.app.Fragment; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 setFinishOnTouchOutside(false); | 137 setFinishOnTouchOutside(false); |
| 138 | 138 |
| 139 if (savedInstanceState != null) { | 139 if (savedInstanceState != null) { |
| 140 mFreProperties = savedInstanceState; | 140 mFreProperties = savedInstanceState; |
| 141 } else if (getIntent() != null) { | 141 } else if (getIntent() != null) { |
| 142 mFreProperties = getIntent().getExtras(); | 142 mFreProperties = getIntent().getExtras(); |
| 143 } else { | 143 } else { |
| 144 mFreProperties = new Bundle(); | 144 mFreProperties = new Bundle(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Skip creating content view if it is a lightweight First Run Experienc
e without using |
| 148 // USE_FRE_FLOW_SEQUENCER. |
| 149 if (!mFreProperties.getBoolean(FirstRunActivity.USE_FRE_FLOW_SEQUENCER))
{ |
| 150 return; |
| 151 } |
| 152 |
| 147 mPager = new ViewPager(this); | 153 mPager = new ViewPager(this); |
| 148 mPager.setId(R.id.fre_pager); | 154 mPager.setId(R.id.fre_pager); |
| 149 setContentView(mPager); | 155 setContentView(mPager); |
| 150 | 156 |
| 151 mProfileDataCache = new ProfileDataCache(FirstRunActivity.this, null); | 157 mProfileDataCache = new ProfileDataCache(FirstRunActivity.this, null); |
| 152 mProfileDataCache.setProfile(Profile.getLastUsedProfile()); | 158 mProfileDataCache.setProfile(Profile.getLastUsedProfile()); |
| 153 new FirstRunFlowSequencer(this, mFreProperties, isMetricsReportingOptIn(
)) { | 159 new FirstRunFlowSequencer(this, mFreProperties, isMetricsReportingOptIn(
)) { |
| 154 @Override | 160 @Override |
| 155 public void onFlowIsKnown(Bundle freProperties) { | 161 public void onFlowIsKnown(Bundle freProperties) { |
| 156 if (freProperties == null) { | 162 if (freProperties == null) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 197 |
| 192 @Override | 198 @Override |
| 193 protected void onPause() { | 199 protected void onPause() { |
| 194 super.onPause(); | 200 super.onPause(); |
| 195 flushPersistentData(); | 201 flushPersistentData(); |
| 196 } | 202 } |
| 197 | 203 |
| 198 @Override | 204 @Override |
| 199 protected void onDestroy() { | 205 protected void onDestroy() { |
| 200 super.onDestroy(); | 206 super.onDestroy(); |
| 201 mProfileDataCache.destroy(); | 207 if (mProfileDataCache != null) mProfileDataCache.destroy(); |
| 202 } | 208 } |
| 203 | 209 |
| 204 @Override | 210 @Override |
| 205 protected void onStart() { | 211 protected void onStart() { |
| 206 super.onStart(); | 212 super.onStart(); |
| 207 stopProgressionIfNotAcceptedTermsOfService(); | 213 stopProgressionIfNotAcceptedTermsOfService(); |
| 208 if (!mFreProperties.getBoolean(USE_FRE_FLOW_SEQUENCER)) { | 214 if (!mFreProperties.getBoolean(USE_FRE_FLOW_SEQUENCER)) { |
| 209 if (FirstRunStatus.getFirstRunFlowComplete(this)) { | 215 if (FirstRunStatus.getFirstRunFlowComplete(this)) { |
| 210 // This is a parallel flow that needs to be refreshed/re-fired. | 216 // This is a parallel flow that needs to be refreshed/re-fired. |
| 211 // Signal the FRE flow completion and re-launch the original int
ent. | 217 // Signal the FRE flow completion and re-launch the original int
ent. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 359 |
| 354 @Override | 360 @Override |
| 355 public boolean isNeverUploadCrashDump() { | 361 public boolean isNeverUploadCrashDump() { |
| 356 return sGlue.isNeverUploadCrashDump(getApplicationContext()); | 362 return sGlue.isNeverUploadCrashDump(getApplicationContext()); |
| 357 } | 363 } |
| 358 | 364 |
| 359 @Override | 365 @Override |
| 360 public void acceptTermsOfService(boolean allowCrashUpload) { | 366 public void acceptTermsOfService(boolean allowCrashUpload) { |
| 361 UmaUtils.recordMetricsReportingDefaultOptIn(isMetricsReportingOptIn()); | 367 UmaUtils.recordMetricsReportingDefaultOptIn(isMetricsReportingOptIn()); |
| 362 sGlue.acceptTermsOfService(getApplicationContext(), allowCrashUpload); | 368 sGlue.acceptTermsOfService(getApplicationContext(), allowCrashUpload); |
| 369 FirstRunStatus.setSkipWelcomePage(FirstRunActivity.this, true); |
| 363 flushPersistentData(); | 370 flushPersistentData(); |
| 364 stopProgressionIfNotAcceptedTermsOfService(); | 371 stopProgressionIfNotAcceptedTermsOfService(); |
| 365 jumpToPage(mPager.getCurrentItem() + 1, true); | 372 jumpToPage(mPager.getCurrentItem() + 1, true); |
| 366 } | 373 } |
| 367 | 374 |
| 368 @Override | 375 @Override |
| 369 public void openAccountAdder(Fragment fragment) { | 376 public void openAccountAdder(Fragment fragment) { |
| 370 sGlue.openAccountAdder(fragment); | 377 sGlue.openAccountAdder(fragment); |
| 371 } | 378 } |
| 372 | 379 |
| 373 protected void flushPersistentData() { | 380 protected void flushPersistentData() { |
| 374 if (mNativeSideIsInitialized) ChromeApplication.flushPersistentData(); | 381 if (mNativeSideIsInitialized) ChromeApplication.flushPersistentData(); |
| 375 } | 382 } |
| 376 | 383 |
| 377 private static void finishAllFREActivities(int result, Intent data) { | 384 protected static void finishAllFREActivities(int result, Intent data) { |
| 378 List<WeakReference<Activity>> activities = ApplicationStatus.getRunningA
ctivities(); | 385 List<WeakReference<Activity>> activities = ApplicationStatus.getRunningA
ctivities(); |
| 379 for (WeakReference<Activity> weakActivity : activities) { | 386 for (WeakReference<Activity> weakActivity : activities) { |
| 380 Activity activity = weakActivity.get(); | 387 Activity activity = weakActivity.get(); |
| 381 if (activity instanceof FirstRunActivity) { | 388 if (activity instanceof FirstRunActivity) { |
| 382 activity.setResult(result, data); | 389 activity.setResult(result, data); |
| 383 activity.finish(); | 390 activity.finish(); |
| 384 } | 391 } |
| 385 } | 392 } |
| 386 } | 393 } |
| 387 | 394 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 return constructor.newInstance(); | 456 return constructor.newInstance(); |
| 450 } | 457 } |
| 451 }; | 458 }; |
| 452 } | 459 } |
| 453 | 460 |
| 454 @Override | 461 @Override |
| 455 public void showEmbedContentViewActivity(int title, int url) { | 462 public void showEmbedContentViewActivity(int title, int url) { |
| 456 EmbedContentViewActivity.show(this, title, url); | 463 EmbedContentViewActivity.show(this, title, url); |
| 457 } | 464 } |
| 458 } | 465 } |
| OLD | NEW |