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

Unified Diff: chrome/browser/android/download/download_controller.cc

Issue 2090853002: Fix an issue that pdf is not auto-opened after typing url in omnibox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/download/download_controller.cc
diff --git a/chrome/browser/android/download/download_controller.cc b/chrome/browser/android/download/download_controller.cc
index 93981c3a77acceecae8707e243b49cc083b2a60d..d7f594a86eb8d50b2bf7f21f32d39efe73cd905b 100644
--- a/chrome/browser/android/download/download_controller.cc
+++ b/chrome/browser/android/download/download_controller.cc
@@ -29,6 +29,7 @@
#include "net/base/filename_util.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
+#include "ui/base/page_transition_types.h"
using base::android::ConvertUTF8ToJavaString;
using base::android::ScopedJavaLocalRef;
@@ -322,6 +323,16 @@ void DownloadController::OnDownloadUpdated(DownloadItem* item) {
ScopedJavaLocalRef<jstring> jreferrer_url =
ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec());
+ ui::PageTransition base_transition =
+ ui::PageTransitionStripQualifier(item->GetTransitionType());
+ bool user_initiated =
+ item->GetTransitionType() & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR ||
+ base_transition == ui::PAGE_TRANSITION_TYPED ||
Ted C 2016/06/22 23:58:03 could we use !PageTransitionIsWebTriggerable here
qinmin 2016/06/23 18:20:11 !PageTransitionIsWebTriggerable could be too broad
+ base_transition == ui::PAGE_TRANSITION_AUTO_BOOKMARK ||
+ base_transition == ui::PAGE_TRANSITION_GENERATED ||
+ base_transition == ui::PAGE_TRANSITION_RELOAD ||
+ base_transition == ui::PAGE_TRANSITION_KEYWORD;
+ bool hasUserGesture = item->HasUserGesture() || user_initiated;
switch (item->GetState()) {
case DownloadItem::IN_PROGRESS: {
base::TimeDelta time_delta;
@@ -331,7 +342,7 @@ void DownloadController::OnDownloadUpdated(DownloadItem* item) {
jmime_type.obj(), jfilename.obj(), jpath.obj(),
item->GetReceivedBytes(), jguid.obj(),
item->PercentComplete(), time_delta.InMilliseconds(),
- item->HasUserGesture(), item->IsPaused(),
+ hasUserGesture, item->IsPaused(),
item->GetBrowserContext()->IsOffTheRecord());
break;
}
@@ -345,7 +356,7 @@ void DownloadController::OnDownloadUpdated(DownloadItem* item) {
env, GetJavaObject()->Controller(env).obj(), jurl.obj(),
jmime_type.obj(), jfilename.obj(), jpath.obj(),
item->GetReceivedBytes(), jguid.obj(),
- joriginal_url.obj(), jreferrer_url.obj(), item->HasUserGesture());
+ joriginal_url.obj(), jreferrer_url.obj(), hasUserGesture);
DownloadController::RecordDownloadCancelReason(
DownloadController::CANCEL_REASON_NOT_CANCELED);
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698