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

Side by Side Diff: android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java

Issue 872363005: Enable zoom and make contents fit into viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP: adjust to comments and check what to do with presubmit check Created 5 years, 10 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
« no previous file with comments | « no previous file | 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.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
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698