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

Side by Side Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2199413003: Make WebAPK use "start URL longest path" as the scope if the scope is missing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl2_scope Created 4 years, 4 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
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/android/webapk/webapk_installer.h" 5 #include "chrome/browser/android/webapk/webapk_installer.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/path_utils.h" 10 #include "base/android/path_utils.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // The number of milliseconds to wait for the WebAPK download URL from the 43 // The number of milliseconds to wait for the WebAPK download URL from the
44 // WebAPK server. 44 // WebAPK server.
45 const int kWebApkDownloadUrlTimeoutMs = 4000; 45 const int kWebApkDownloadUrlTimeoutMs = 4000;
46 46
47 // The number of milliseconds to wait for the WebAPK download to complete. 47 // The number of milliseconds to wait for the WebAPK download to complete.
48 const int kDownloadTimeoutMs = 20000; 48 const int kDownloadTimeoutMs = 20000;
49 49
50 // Returns the scope from |info| if it is specified. Otherwise, returns the 50 // Returns the scope from |info| if it is specified. Otherwise, returns the
51 // default scope. 51 // default scope.
52 GURL GetScope(const ShortcutInfo& info) { 52 GURL GetScope(const ShortcutInfo& info) {
53 return (info.scope.is_valid()) ? info.scope : info.url.GetOrigin(); 53 return (info.scope.is_valid())
54 ? info.scope
55 : ShortcutHelper::GetScopeFromURL(info.url);
54 } 56 }
55 57
56 // Computes a murmur2 hash of |bitmap|'s PNG encoded bytes. 58 // Computes a murmur2 hash of |bitmap|'s PNG encoded bytes.
57 uint64_t ComputeBitmapHash(const SkBitmap& bitmap) { 59 uint64_t ComputeBitmapHash(const SkBitmap& bitmap) {
58 std::vector<unsigned char> png_bytes; 60 std::vector<unsigned char> png_bytes;
59 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_bytes); 61 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_bytes);
60 return MurmurHash64B(&png_bytes.front(), png_bytes.size(), kMurmur2HashSeed); 62 return MurmurHash64B(&png_bytes.front(), png_bytes.size(), kMurmur2HashSeed);
61 } 63 }
62 64
63 // Converts a color from the format specified in content::Manifest to a CSS 65 // Converts a color from the format specified in content::Manifest to a CSS
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 273
272 void WebApkInstaller::OnSuccess() { 274 void WebApkInstaller::OnSuccess() {
273 finish_callback_.Run(true); 275 finish_callback_.Run(true);
274 delete this; 276 delete this;
275 } 277 }
276 278
277 void WebApkInstaller::OnFailure() { 279 void WebApkInstaller::OnFailure() {
278 finish_callback_.Run(false); 280 finish_callback_.Run(false);
279 delete this; 281 delete this;
280 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698