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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 /** | 155 /** |
156 * Initializes the ContentView based on the native tab contents pointer pass
ed in. | 156 * Initializes the ContentView based on the native tab contents pointer pass
ed in. |
157 * @param nativeTabContents The pointer to the native tab contents object. | 157 * @param nativeTabContents The pointer to the native tab contents object. |
158 */ | 158 */ |
159 @SuppressWarnings("unused") | 159 @SuppressWarnings("unused") |
160 @CalledByNative | 160 @CalledByNative |
161 private void initFromNativeTabContents(int nativeTabContents) { | 161 private void initFromNativeTabContents(int nativeTabContents) { |
162 mContentView = new ContentView( | 162 mContentView = new ContentView( |
163 getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME)
; | 163 getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME)
; |
| 164 if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.get
Url()); |
164 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, | 165 ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentVi
ew, |
165 new FrameLayout.LayoutParams( | 166 new FrameLayout.LayoutParams( |
166 FrameLayout.LayoutParams.MATCH_PARENT, | 167 FrameLayout.LayoutParams.MATCH_PARENT, |
167 FrameLayout.LayoutParams.MATCH_PARENT)); | 168 FrameLayout.LayoutParams.MATCH_PARENT)); |
168 mContentView.requestFocus(); | 169 mContentView.requestFocus(); |
169 } | 170 } |
170 | 171 |
171 /** | 172 /** |
172 * @return The {@link ContentView} currently shown by this Shell. | 173 * @return The {@link ContentView} currently shown by this Shell. |
173 */ | 174 */ |
174 public ContentView getContentView() { | 175 public ContentView getContentView() { |
175 return mContentView; | 176 return mContentView; |
176 } | 177 } |
177 | 178 |
178 private void setKeyboardVisibilityForUrl(boolean visible) { | 179 private void setKeyboardVisibilityForUrl(boolean visible) { |
179 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( | 180 InputMethodManager imm = (InputMethodManager) getContext().getSystemServ
ice( |
180 Context.INPUT_METHOD_SERVICE); | 181 Context.INPUT_METHOD_SERVICE); |
181 if (visible) { | 182 if (visible) { |
182 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); | 183 imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); |
183 } else { | 184 } else { |
184 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 185 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
185 } | 186 } |
186 } | 187 } |
187 } | 188 } |
OLD | NEW |