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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.java

Issue 639703004: Optimizing DateTimeAndroid and ColorChooserAndroid initializations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the review comments. Created 6 years, 1 month 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.app.Activity;
7 import android.content.Context; 8 import android.content.Context;
8 9
9 import org.chromium.base.CalledByNative; 10 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 11 import org.chromium.base.JNINamespace;
11 import org.chromium.content.browser.ContentViewCore; 12 import org.chromium.ui.base.WindowAndroid;
12 import org.chromium.ui.picker.DateTimeSuggestion; 13 import org.chromium.ui.picker.DateTimeSuggestion;
13 import org.chromium.ui.picker.InputDialogContainer; 14 import org.chromium.ui.picker.InputDialogContainer;
14 15
15 /** 16 /**
16 * Plumbing for the different date/time dialog adapters. 17 * Plumbing for the different date/time dialog adapters.
17 */ 18 */
18 @JNINamespace("content") 19 @JNINamespace("content")
19 class DateTimeChooserAndroid { 20 class DateTimeChooserAndroid {
20 21
21 private final long mNativeDateTimeChooserAndroid; 22 private final long mNativeDateTimeChooserAndroid;
(...skipping 18 matching lines...) Expand all
40 } 41 }
41 42
42 private void showDialog(int dialogType, double dialogValue, 43 private void showDialog(int dialogType, double dialogValue,
43 double min, double max, double step, 44 double min, double max, double step,
44 DateTimeSuggestion[] suggestions) { 45 DateTimeSuggestion[] suggestions) {
45 mInputDialogContainer.showDialog(dialogType, dialogValue, min, max, step , suggestions); 46 mInputDialogContainer.showDialog(dialogType, dialogValue, min, max, step , suggestions);
46 } 47 }
47 48
48 @CalledByNative 49 @CalledByNative
49 private static DateTimeChooserAndroid createDateTimeChooser( 50 private static DateTimeChooserAndroid createDateTimeChooser(
50 ContentViewCore contentViewCore, 51 WindowAndroid windowAndroid,
51 long nativeDateTimeChooserAndroid, 52 long nativeDateTimeChooserAndroid,
52 int dialogType, double dialogValue, 53 int dialogType, double dialogValue,
53 double min, double max, double step, 54 double min, double max, double step,
54 DateTimeSuggestion[] suggestions) { 55 DateTimeSuggestion[] suggestions) {
56 Activity windowAndroidActivity = windowAndroid.getActivity().get();
57 if (windowAndroidActivity == null) return null;
55 DateTimeChooserAndroid chooser = 58 DateTimeChooserAndroid chooser =
56 new DateTimeChooserAndroid( 59 new DateTimeChooserAndroid(windowAndroidActivity, nativeDateTime ChooserAndroid);
57 contentViewCore.getContext(),
58 nativeDateTimeChooserAndroid);
59 chooser.showDialog(dialogType, dialogValue, min, max, step, suggestions) ; 60 chooser.showDialog(dialogType, dialogValue, min, max, step, suggestions) ;
60 return chooser; 61 return chooser;
61 } 62 }
62 63
63 @CalledByNative 64 @CalledByNative
64 private static DateTimeSuggestion[] createSuggestionsArray(int size) { 65 private static DateTimeSuggestion[] createSuggestionsArray(int size) {
65 return new DateTimeSuggestion[size]; 66 return new DateTimeSuggestion[size];
66 } 67 }
67 68
68 /** 69 /**
(...skipping 18 matching lines...) Expand all
87 textInputTypeDate, 88 textInputTypeDate,
88 textInputTypeDateTime, textInputTypeDateTimeLocal, 89 textInputTypeDateTime, textInputTypeDateTimeLocal,
89 textInputTypeMonth, textInputTypeTime, textInputTypeWeek); 90 textInputTypeMonth, textInputTypeTime, textInputTypeWeek);
90 } 91 }
91 92
92 private native void nativeReplaceDateTime(long nativeDateTimeChooserAndroid, 93 private native void nativeReplaceDateTime(long nativeDateTimeChooserAndroid,
93 double dialogValue); 94 double dialogValue);
94 95
95 private native void nativeCancelDialog(long nativeDateTimeChooserAndroid); 96 private native void nativeCancelDialog(long nativeDateTimeChooserAndroid);
96 } 97 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698