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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_manager.cc

Issue 2630523002: Ensure the entire page is secure for PWAs. (Closed)
Patch Set: Whitelist localhost Created 3 years, 11 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 #include "chrome/browser/android/webapps/add_to_homescreen_manager.h" 5 #include "chrome/browser/android/webapps/add_to_homescreen_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" 14 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
15 #include "chrome/browser/android/shortcut_helper.h" 15 #include "chrome/browser/android/shortcut_helper.h"
16 #include "chrome/browser/android/webapk/chrome_webapk_host.h" 16 #include "chrome/browser/android/webapk/chrome_webapk_host.h"
17 #include "chrome/browser/android/webapk/webapk_install_service.h" 17 #include "chrome/browser/android/webapk/webapk_install_service.h"
18 #include "chrome/browser/android/webapk/webapk_metrics.h" 18 #include "chrome/browser/android/webapk/webapk_metrics.h"
19 #include "chrome/browser/banners/app_banner_settings_helper.h" 19 #include "chrome/browser/banners/app_banner_settings_helper.h"
20 #include "chrome/browser/installable/installable_manager.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/render_frame_host.h" 22 #include "content/public/browser/render_frame_host.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/origin_util.h"
24 #include "jni/AddToHomescreenManager_jni.h" 24 #include "jni/AddToHomescreenManager_jni.h"
25 #include "mojo/public/cpp/bindings/interface_request.h" 25 #include "mojo/public/cpp/bindings/interface_request.h"
26 #include "services/service_manager/public/cpp/interface_provider.h" 26 #include "services/service_manager/public/cpp/interface_provider.h"
27 #include "third_party/WebKit/public/platform/modules/installation/installation.m ojom.h" 27 #include "third_party/WebKit/public/platform/modules/installation/installation.m ojom.h"
28 #include "ui/gfx/android/java_bitmap.h" 28 #include "ui/gfx/android/java_bitmap.h"
29 29
30 using base::android::JavaParamRef; 30 using base::android::JavaParamRef;
31 using base::android::ScopedJavaLocalRef; 31 using base::android::ScopedJavaLocalRef;
32 32
33 jlong InitializeAndStart(JNIEnv* env, 33 jlong InitializeAndStart(JNIEnv* env,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (data_fetcher_->is_ready()) { 70 if (data_fetcher_->is_ready()) {
71 // If the fetcher isn't ready yet, the shortcut will be added when it is 71 // If the fetcher isn't ready yet, the shortcut will be added when it is
72 // via OnDataAvailable(); 72 // via OnDataAvailable();
73 AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->shortcut_icon()); 73 AddShortcut(data_fetcher_->shortcut_info(), data_fetcher_->shortcut_icon());
74 } 74 }
75 } 75 }
76 76
77 void AddToHomescreenManager::Start(content::WebContents* web_contents) { 77 void AddToHomescreenManager::Start(content::WebContents* web_contents) {
78 bool check_webapk_compatible = false; 78 bool check_webapk_compatible = false;
79 if (ChromeWebApkHost::AreWebApkEnabled() && 79 if (ChromeWebApkHost::AreWebApkEnabled() &&
80 content::IsOriginSecure(web_contents->GetLastCommittedURL())) { 80 InstallableManager::IsContentSecure(web_contents)) {
81 check_webapk_compatible = true; 81 check_webapk_compatible = true;
82 } else { 82 } else {
83 ShowDialog(); 83 ShowDialog();
84 } 84 }
85 85
86 data_fetcher_ = new AddToHomescreenDataFetcher( 86 data_fetcher_ = new AddToHomescreenDataFetcher(
87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(), 87 web_contents, ShortcutHelper::GetIdealHomescreenIconSizeInPx(),
88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(), 88 ShortcutHelper::GetMinimumHomescreenIconSizeInPx(),
89 ShortcutHelper::GetIdealSplashImageSizeInPx(), 89 ShortcutHelper::GetIdealSplashImageSizeInPx(),
90 ShortcutHelper::GetMinimumSplashImageSizeInPx(), 90 ShortcutHelper::GetMinimumSplashImageSizeInPx(),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground( 197 SkBitmap AddToHomescreenManager::FinalizeLauncherIconInBackground(
198 const SkBitmap& bitmap, 198 const SkBitmap& bitmap,
199 const GURL& url, 199 const GURL& url,
200 bool* is_generated) { 200 bool* is_generated) {
201 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 201 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
202 202
203 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url, 203 return ShortcutHelper::FinalizeLauncherIconInBackground(bitmap, url,
204 is_generated); 204 is_generated);
205 } 205 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/banners/app_banner_manager.cc » ('j') | chrome/browser/installable/installable_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698