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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java

Issue 2273373003: [Offline pages] Refactor createClientIdForTabSharing and ClientId/UUID creation (Closed)
Patch Set: Include Guid in name to prevent possible confusion Created 4 years, 3 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.offlinepages; 5 package org.chromium.chrome.browser.offlinepages;
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 import android.content.IntentFilter; 10 import android.content.IntentFilter;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 * @return a callback of OfflinePageItem 353 * @return a callback of OfflinePageItem
354 */ 354 */
355 private static Callback<OfflinePageItem> selectPageForOnlineUrlCallback( 355 private static Callback<OfflinePageItem> selectPageForOnlineUrlCallback(
356 final WebContents webContents, final OfflinePageBridge offlinePageBr idge, 356 final WebContents webContents, final OfflinePageBridge offlinePageBr idge,
357 final Callback<OfflinePageItem> prepareForSharing) { 357 final Callback<OfflinePageItem> prepareForSharing) {
358 return new Callback<OfflinePageItem>() { 358 return new Callback<OfflinePageItem>() {
359 @Override 359 @Override
360 public void onResult(OfflinePageItem item) { 360 public void onResult(OfflinePageItem item) {
361 if (item == null) { 361 if (item == null) {
362 // If the page has no offline copy, save the page offline. 362 // If the page has no offline copy, save the page offline.
363 ClientId clientId = ClientId.createClientIdForTabSharing(); 363 ClientId clientId = ClientId.createGuidClientIdForNamespace(
364 OfflinePageBridge.SHARE_NAMESPACE);
364 offlinePageBridge.savePage(webContents, clientId, 365 offlinePageBridge.savePage(webContents, clientId,
365 savePageCallback(prepareForSharing, offlinePageBridg e)); 366 savePageCallback(prepareForSharing, offlinePageBridg e));
366 return; 367 return;
367 } 368 }
368 // If the online page has offline copy associated with it, use t he file directly. 369 // If the online page has offline copy associated with it, use t he file directly.
369 prepareForSharing.onResult(item); 370 prepareForSharing.onResult(item);
370 } 371 }
371 }; 372 };
372 } 373 }
373 374
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 @VisibleForTesting 580 @VisibleForTesting
580 static void setInstanceForTesting(OfflinePageUtils instance) { 581 static void setInstanceForTesting(OfflinePageUtils instance) {
581 sInstance = instance; 582 sInstance = instance;
582 } 583 }
583 584
584 @VisibleForTesting 585 @VisibleForTesting
585 public static void setSnackbarDurationForTesting(int durationMs) { 586 public static void setSnackbarDurationForTesting(int durationMs) {
586 sSnackbarDurationMs = durationMs; 587 sSnackbarDurationMs = durationMs;
587 } 588 }
588 } 589 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698