| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shortcut_helper.h" | 5 #include "chrome/browser/android/shortcut_helper.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 shortcut_info_.UpdateFromManifest(manifest); | 124 shortcut_info_.UpdateFromManifest(manifest); |
| 125 | 125 |
| 126 GURL icon_src = ManifestIconSelector::FindBestMatchingIcon( | 126 GURL icon_src = ManifestIconSelector::FindBestMatchingIcon( |
| 127 manifest.icons, | 127 manifest.icons, |
| 128 kPreferredIconSizeInDp, | 128 kPreferredIconSizeInDp, |
| 129 gfx::Screen::GetScreenFor(web_contents()->GetNativeView())); | 129 gfx::Screen::GetScreenFor(web_contents()->GetNativeView())); |
| 130 if (icon_src.is_valid()) { | 130 if (icon_src.is_valid()) { |
| 131 web_contents()->DownloadImage(icon_src, | 131 web_contents()->DownloadImage(icon_src, |
| 132 false, | 132 false, |
| 133 preferred_icon_size_in_px_, | 133 preferred_icon_size_in_px_, |
| 134 blink::WebURLRequest::UseProtocolCachePolicy, |
| 134 base::Bind(&ShortcutHelper::OnDidDownloadIcon, | 135 base::Bind(&ShortcutHelper::OnDidDownloadIcon, |
| 135 weak_ptr_factory_.GetWeakPtr())); | 136 weak_ptr_factory_.GetWeakPtr())); |
| 136 manifest_icon_status_ = MANIFEST_ICON_STATUS_FETCHING; | 137 manifest_icon_status_ = MANIFEST_ICON_STATUS_FETCHING; |
| 137 } | 138 } |
| 138 | 139 |
| 139 // The ShortcutHelper is now able to notify its Java counterpart that it is | 140 // The ShortcutHelper is now able to notify its Java counterpart that it is |
| 140 // initialized. OnInitialized method is not conceptually part of getting the | 141 // initialized. OnInitialized method is not conceptually part of getting the |
| 141 // manifest data but it happens that the initialization is finalized when | 142 // manifest data but it happens that the initialization is finalized when |
| 142 // these data are available. | 143 // these data are available. |
| 143 JNIEnv* env = base::android::AttachCurrentThread(); | 144 JNIEnv* env = base::android::AttachCurrentThread(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 base::android::GetApplicationContext(), | 330 base::android::GetApplicationContext(), |
| 330 java_url.obj(), | 331 java_url.obj(), |
| 331 java_title.obj(), | 332 java_title.obj(), |
| 332 java_bitmap.obj(), | 333 java_bitmap.obj(), |
| 333 r_value, | 334 r_value, |
| 334 g_value, | 335 g_value, |
| 335 b_value, | 336 b_value, |
| 336 info.display == content::Manifest::DISPLAY_MODE_STANDALONE, | 337 info.display == content::Manifest::DISPLAY_MODE_STANDALONE, |
| 337 info.orientation); | 338 info.orientation); |
| 338 } | 339 } |
| OLD | NEW |