Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/dom_distiller/feedback_reporter_android.h" | 5 #include "chrome/browser/android/dom_distiller/feedback_reporter_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "components/dom_distiller/core/feedback_reporter.h" | 10 #include "components/dom_distiller/core/feedback_reporter.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 jobject obj, | 42 jobject obj, |
| 43 jobject jweb_contents) { | 43 jobject jweb_contents) { |
| 44 content::WebContents* web_contents = | 44 content::WebContents* web_contents = |
| 45 content::WebContents::FromJavaWebContents(jweb_contents); | 45 content::WebContents::FromJavaWebContents(jweb_contents); |
| 46 Observe(web_contents); | 46 Observe(web_contents); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void FeedbackReporterAndroid::DidNavigateMainFrame( | 49 void FeedbackReporterAndroid::DidNavigateMainFrame( |
| 50 const content::LoadCommittedDetails& details, | 50 const content::LoadCommittedDetails& details, |
| 51 const content::FrameNavigateParams& params) { | 51 const content::FrameNavigateParams& params) { |
| 52 // TODO(mdjones): Remove all existing code for the android view version | |
|
cjhopman
2015/04/03 17:38:30
This is sort of weird because it breaks this class
mdjones
2015/04/03 18:49:21
Done.
| |
| 53 // of the feedback overlay. | |
| 54 // NOTE: This stops the call to open feedback. | |
| 55 return; | |
| 56 | |
| 52 JNIEnv* env = base::android::AttachCurrentThread(); | 57 JNIEnv* env = base::android::AttachCurrentThread(); |
| 53 ScopedJavaLocalRef<jobject> jobj = weak_java_feedback_reporter_.get(env); | 58 ScopedJavaLocalRef<jobject> jobj = weak_java_feedback_reporter_.get(env); |
| 54 if (jobj.is_null()) | 59 if (jobj.is_null()) |
| 55 return; | 60 return; |
| 56 Java_DomDistillerFeedbackReporter_dismissOverlay(env, jobj.obj()); | 61 Java_DomDistillerFeedbackReporter_dismissOverlay(env, jobj.obj()); |
| 57 GURL url = details.entry->GetURL(); | 62 GURL url = details.entry->GetURL(); |
| 58 if (dom_distiller::url_utils::IsDistilledPage(url)) { | 63 if (dom_distiller::url_utils::IsDistilledPage(url)) { |
| 59 Java_DomDistillerFeedbackReporter_showOverlay(env, jobj.obj()); | 64 Java_DomDistillerFeedbackReporter_showOverlay(env, jobj.obj()); |
| 60 } | 65 } |
| 61 } | 66 } |
| 62 | 67 |
| 63 jlong Init(JNIEnv* env, jobject obj) { | 68 jlong Init(JNIEnv* env, jobject obj) { |
| 64 FeedbackReporterAndroid* reporter = new FeedbackReporterAndroid(env, obj); | 69 FeedbackReporterAndroid* reporter = new FeedbackReporterAndroid(env, obj); |
| 65 return reinterpret_cast<intptr_t>(reporter); | 70 return reinterpret_cast<intptr_t>(reporter); |
| 66 } | 71 } |
| 67 | 72 |
| 68 // static | 73 // static |
| 69 bool RegisterFeedbackReporter(JNIEnv* env) { return RegisterNativesImpl(env); } | 74 bool RegisterFeedbackReporter(JNIEnv* env) { return RegisterNativesImpl(env); } |
| 70 | 75 |
| 71 } // namespace android | 76 } // namespace android |
| 72 | 77 |
| 73 } // namespace dom_distiller | 78 } // namespace dom_distiller |
| OLD | NEW |