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

Side by Side Diff: chrome/browser/ui/android/autofill/autofill_popup_view_android.cc

Issue 12556002: Always Close the Autofill UI through the same path (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Disable Test On Linux Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/android/autofill/autofill_popup_view_android.h" 5 #include "chrome/browser/ui/android/autofill/autofill_popup_view_android.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 "chrome/browser/ui/android/window_android_helper.h" 9 #include "chrome/browser/ui/android/window_android_helper.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
11 #include "content/public/browser/android/content_view_core.h" 11 #include "content/public/browser/android/content_view_core.h"
12 #include "jni/AutofillPopupGlue_jni.h" 12 #include "jni/AutofillPopupGlue_jni.h"
13 #include "ui/gfx/android/window_android.h" 13 #include "ui/gfx/android/window_android.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 15
16 using base::android::MethodID; 16 using base::android::MethodID;
17 17
18 AutofillPopupViewAndroid::AutofillPopupViewAndroid( 18 AutofillPopupViewAndroid::AutofillPopupViewAndroid(
19 AutofillPopupController* controller) 19 AutofillPopupController* controller)
20 : controller_(controller) {} 20 : controller_(controller) {}
21 21
22 AutofillPopupViewAndroid::~AutofillPopupViewAndroid() { 22 AutofillPopupViewAndroid::~AutofillPopupViewAndroid() {}
23 controller_->ViewDestroyed();
24 }
25 23
26 void AutofillPopupViewAndroid::Show() { 24 void AutofillPopupViewAndroid::Show() {
27 JNIEnv* env = base::android::AttachCurrentThread(); 25 JNIEnv* env = base::android::AttachCurrentThread();
28 content::ContentViewCore* content_view_core = controller_->container_view(); 26 content::ContentViewCore* content_view_core = controller_->container_view();
29 27
30 java_object_.Reset(Java_AutofillPopupGlue_create( 28 java_object_.Reset(Java_AutofillPopupGlue_create(
31 env, 29 env,
32 reinterpret_cast<jint>(this), 30 reinterpret_cast<jint>(this),
33 content_view_core->GetWindowAndroid()->GetJavaObject().obj(), 31 content_view_core->GetWindowAndroid()->GetJavaObject().obj(),
34 content_view_core->GetContainerViewDelegate().obj())); 32 content_view_core->GetContainerViewDelegate().obj()));
35 33
36 UpdateBoundsAndRedrawPopup(); 34 UpdateBoundsAndRedrawPopup();
37 } 35 }
38 36
39 void AutofillPopupViewAndroid::Hide() { 37 void AutofillPopupViewAndroid::Hide() {
38 AutofillPopupView::Hide();
39
40 JNIEnv* env = base::android::AttachCurrentThread(); 40 JNIEnv* env = base::android::AttachCurrentThread();
41 Java_AutofillPopupGlue_dismiss(env, java_object_.obj()); 41 Java_AutofillPopupGlue_dismiss(env, java_object_.obj());
42 } 42 }
43 43
44 void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { 44 void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() {
45 JNIEnv* env = base::android::AttachCurrentThread(); 45 JNIEnv* env = base::android::AttachCurrentThread();
46 Java_AutofillPopupGlue_setAnchorRect(env, 46 Java_AutofillPopupGlue_setAnchorRect(env,
47 java_object_.obj(), 47 java_object_.obj(),
48 controller_->element_bounds().x(), 48 controller_->element_bounds().x(),
49 controller_->element_bounds().y(), 49 controller_->element_bounds().y(),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // static 93 // static
94 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) { 94 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) {
95 return RegisterNativesImpl(env); 95 return RegisterNativesImpl(env);
96 } 96 }
97 97
98 // static 98 // static
99 AutofillPopupView* AutofillPopupView::Create( 99 AutofillPopupView* AutofillPopupView::Create(
100 AutofillPopupController* controller) { 100 AutofillPopupController* controller) {
101 return new AutofillPopupViewAndroid(controller); 101 return new AutofillPopupViewAndroid(controller);
102 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698