OLD | NEW |
---|---|
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.android_webview.shell; | 5 package org.chromium.android_webview.shell; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 return false; | 142 return false; |
143 } | 143 } |
144 }; | 144 }; |
145 | 145 |
146 SharedPreferences sharedPreferences = | 146 SharedPreferences sharedPreferences = |
147 getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); | 147 getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); |
148 if (mBrowserContext == null) { | 148 if (mBrowserContext == null) { |
149 mBrowserContext = new AwBrowserContext(sharedPreferences); | 149 mBrowserContext = new AwBrowserContext(sharedPreferences); |
150 } | 150 } |
151 final AwSettings awSettings = new AwSettings(this /*context*/, | 151 final AwSettings awSettings = new AwSettings(this /*context*/, |
152 false /*isAccessFromFileURLsGrantedByDefault*/, true /*supportsL egacyQuirks*/); | 152 false /*isAccessFromFileURLsGrantedByDefault*/, false /*supports LegacyQuirks*/); |
153 // Required for WebGL conformance tests. | 153 // Required for WebGL conformance tests. |
154 awSettings.setMediaPlaybackRequiresUserGesture(false); | 154 awSettings.setMediaPlaybackRequiresUserGesture(false); |
155 // Allow zoom and fit contents to screen | |
156 awSettings.setBuiltInZoomControls(true); | |
157 awSettings.setDisplayZoomControls(false); | |
158 awSettings.setUseWideViewPort(true); | |
159 awSettings.setLoadWithOverviewMode(true); | |
160 awSettings.setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm .TEXT_AUTOSIZING); | |
161 | |
155 testContainerView.initialize(new AwContents(mBrowserContext, testContain erView, | 162 testContainerView.initialize(new AwContents(mBrowserContext, testContain erView, |
156 testContainerView.getContext(), testContainerView.getInternalAcc essDelegate(), | 163 testContainerView.getContext(), testContainerView.getInternalAcc essDelegate(), |
157 testContainerView.getNativeGLDelegate(), awContentsClient, awSet tings)); | 164 testContainerView.getNativeGLDelegate(), awContentsClient, awSet tings)); |
158 testContainerView.getAwContents().getSettings().setJavaScriptEnabled(tru e); | 165 testContainerView.getAwContents().getSettings().setJavaScriptEnabled(tru e); |
159 if (mDevToolsServer == null) { | 166 if (mDevToolsServer == null) { |
160 mDevToolsServer = new AwDevToolsServer(); | 167 mDevToolsServer = new AwDevToolsServer(); |
161 mDevToolsServer.setRemoteDebuggingEnabled(true); | 168 mDevToolsServer.setRemoteDebuggingEnabled(true); |
162 } | 169 } |
163 return testContainerView; | 170 return testContainerView; |
164 } | 171 } |
(...skipping 10 matching lines...) Expand all Loading... | |
175 } else { | 182 } else { |
176 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); | 183 imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); |
177 } | 184 } |
178 } | 185 } |
179 | 186 |
180 private void initializeUrlField() { | 187 private void initializeUrlField() { |
181 mUrlTextView = (EditText) findViewById(R.id.url); | 188 mUrlTextView = (EditText) findViewById(R.id.url); |
182 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { | 189 mUrlTextView.setOnEditorActionListener(new OnEditorActionListener() { |
183 @Override | 190 @Override |
184 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { | 191 public boolean onEditorAction(TextView v, int actionId, KeyEvent eve nt) { |
185 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null || | 192 if ((actionId != EditorInfo.IME_ACTION_GO) && (event == null |
186 event.getKeyCode() != KeyEvent.KEYCODE_ENTER || | 193 || event.getKeyCode() != KeyEvent.KEYCODE_ENTER |
187 event.getAction() != KeyEvent.ACTION_DOWN)) { | 194 || event.getAction() != KeyEvent.ACTION_DOWN)) { |
Sergey
2015/02/03 07:11:43
git cl upload presubmit check annoyingly fails her
mnaganov (inactive)
2015/02/03 08:58:52
Absolutely.
| |
188 return false; | 195 return false; |
189 } | 196 } |
190 | 197 |
191 mAwTestContainerView.getAwContents().loadUrl( | 198 mAwTestContainerView.getAwContents().loadUrl( |
192 new LoadUrlParams(mUrlTextView.getText().toString())); | 199 new LoadUrlParams(mUrlTextView.getText().toString())); |
193 mUrlTextView.clearFocus(); | 200 mUrlTextView.clearFocus(); |
194 setKeyboardVisibilityForUrl(false); | 201 setKeyboardVisibilityForUrl(false); |
195 mAwTestContainerView.requestFocus(); | 202 mAwTestContainerView.requestFocus(); |
196 return true; | 203 return true; |
197 } | 204 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 if (keyCode == KeyEvent.KEYCODE_BACK) { | 243 if (keyCode == KeyEvent.KEYCODE_BACK) { |
237 if (mNavigationController.canGoBack()) { | 244 if (mNavigationController.canGoBack()) { |
238 mNavigationController.goBack(); | 245 mNavigationController.goBack(); |
239 return true; | 246 return true; |
240 } | 247 } |
241 } | 248 } |
242 | 249 |
243 return super.onKeyUp(keyCode, event); | 250 return super.onKeyUp(keyCode, event); |
244 } | 251 } |
245 } | 252 } |
OLD | NEW |