OLD | NEW |
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 package org.chromium.content_shell; | 5 package org.chromium.content_shell; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.drawable.ClipDrawable; | 8 import android.graphics.drawable.ClipDrawable; |
9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
10 import android.util.AttributeSet; | 10 import android.util.AttributeSet; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (progress == 1.0) postDelayed(mClearProgressRunnable, COMPLETED_PROGR
ESS_TIMEOUT_MS); | 164 if (progress == 1.0) postDelayed(mClearProgressRunnable, COMPLETED_PROGR
ESS_TIMEOUT_MS); |
165 } | 165 } |
166 | 166 |
167 /** | 167 /** |
168 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 168 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
169 * @param nativeTabContents The pointer to the native tab contents object. | 169 * @param nativeTabContents The pointer to the native tab contents object. |
170 */ | 170 */ |
171 @SuppressWarnings("unused") | 171 @SuppressWarnings("unused") |
172 @CalledByNative | 172 @CalledByNative |
173 private void initFromNativeTabContents(int nativeTabContents) { | 173 private void initFromNativeTabContents(int nativeTabContents) { |
174 mContentView = new ContentView( | 174 mContentView = ContentView.newInstance( |
175 getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME)
; | 175 getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME)
; |
176 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); | 176 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); |
177 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, | 177 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, |
178 new FrameLayout.LayoutParams( | 178 new FrameLayout.LayoutParams( |
179 FrameLayout.LayoutParams.MATCH_PARENT, | 179 FrameLayout.LayoutParams.MATCH_PARENT, |
180 FrameLayout.LayoutParams.MATCH_PARENT)); | 180 FrameLayout.LayoutParams.MATCH_PARENT)); |
181 mContentView.requestFocus(); | 181 mContentView.requestFocus(); |
182 } | 182 } |
183 | 183 |
184 /** | 184 /** |
185 * @return The {@link ContentView} currently shown by this Shell. | 185 * @return The {@link ContentView} currently shown by this Shell. |
186 */ | 186 */ |
187 public ContentView getContentView() { | 187 public ContentView getContentView() { |
188 return mContentView; | 188 return mContentView; |
189 } | 189 } |
190 | 190 |
191 private void setKeyboardVisibilityForUrl(boolean visible) { | 191 private void setKeyboardVisibilityForUrl(boolean visible) { |
192 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 192 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
193 Context.INPUT_METHOD_SERVICE); | 193 Context.INPUT_METHOD_SERVICE); |
194 if (visible) { | 194 if (visible) { |
195 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 195 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
196 } else { | 196 } else { |
197 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 197 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
OLD | NEW |