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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Issue 2636833003: Support "display": "fullscreen" for sites added to the home screen. (Closed)
Patch Set: refactoring code for performance Created 3 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.graphics.Color; 9 import android.graphics.Color;
10 import android.graphics.drawable.Drawable; 10 import android.graphics.drawable.Drawable;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 super.onNewIntent(intent); 85 super.onNewIntent(intent);
86 86
87 WebappInfo newWebappInfo = createWebappInfo(intent); 87 WebappInfo newWebappInfo = createWebappInfo(intent);
88 if (newWebappInfo == null) { 88 if (newWebappInfo == null) {
89 Log.e(TAG, "Failed to parse new Intent: " + intent); 89 Log.e(TAG, "Failed to parse new Intent: " + intent);
90 finish(); 90 finish();
91 } else if (!TextUtils.equals(mWebappInfo.id(), newWebappInfo.id())) { 91 } else if (!TextUtils.equals(mWebappInfo.id(), newWebappInfo.id())) {
92 mWebappInfo = newWebappInfo; 92 mWebappInfo = newWebappInfo;
93 resetSavedInstanceState(); 93 resetSavedInstanceState();
94 if (mIsInitialized) initializeUI(null); 94 if (mIsInitialized) initializeUI(null);
95 // TODO(dominickn): send the web app into fullscreen if mDisplayMode is 95 // TODO(dominickn): send the web app into fullscreen if mDisplayMode is
dominickn 2017/01/18 05:56:17 Please delete this comment - it's not needed any m
Leo 2017/01/18 23:03:12 Acknowledged.
96 // WebDisplayMode.Fullscreen. See crbug.com/581522 96 // WebDisplayMode.Fullscreen. See crbug.com/581522
97 } 97 }
98 } 98 }
99 99
100 protected boolean isInitialized() { 100 protected boolean isInitialized() {
101 return mIsInitialized; 101 return mIsInitialized;
102 } 102 }
103 103
104 protected WebappInfo createWebappInfo(Intent intent) { 104 protected WebappInfo createWebappInfo(Intent intent) {
105 return (intent == null) ? WebappInfo.createEmpty() : WebappInfo.create(i ntent); 105 return (intent == null) ? WebappInfo.createEmpty() : WebappInfo.create(i ntent);
106 } 106 }
107 107
108 private void initializeUI(Bundle savedInstanceState) { 108 private void initializeUI(Bundle savedInstanceState) {
109 // We do not load URL when restoring from saved instance states. 109 // We do not load URL when restoring from saved instance states.
110 if (savedInstanceState == null && mWebappInfo.isInitialized()) { 110 if (savedInstanceState == null && mWebappInfo.isInitialized()) {
111 if (TextUtils.isEmpty(getActivityTab().getUrl())) { 111 if (TextUtils.isEmpty(getActivityTab().getUrl())) {
112 getActivityTab().loadUrl(new LoadUrlParams( 112 getActivityTab().loadUrl(new LoadUrlParams(
113 mWebappInfo.uri().toString(), PageTransition.AUTO_TOPLEV EL)); 113 mWebappInfo.uri().toString(), PageTransition.AUTO_TOPLEV EL));
114 } 114 }
115 } else { 115 } else {
116 if (NetworkChangeNotifier.isOnline()) getActivityTab().reloadIgnorin gCache(); 116 if (NetworkChangeNotifier.isOnline()) getActivityTab().reloadIgnorin gCache();
117 } 117 }
118 118
119 getActivityTab().addObserver(createTabObserver()); 119 getActivityTab().addObserver(createTabObserver());
120 getActivityTab().getTabWebContentsDelegateAndroid().setDisplayMode( 120
121 WebDisplayMode.Standalone); 121 // Add Fullscreen support and the other modes will fallback to Standalon e.
dominickn 2017/01/18 05:56:17 Nit: the comment here probably isn't necessary (th
Leo 2017/01/18 23:03:12 Acknowledged.
122 // TODO(dominickn): send the web app into fullscreen if mDisplayMode is 122 if (mWebappInfo.displayMode() == WebDisplayMode.Fullscreen) {
123 // WebDisplayMode.Fullscreen. See crbug.com/581522 123 getActivityTab().getTabWebContentsDelegateAndroid().setDisplayMode(
124 WebDisplayMode.Fullscreen);
125 enterImmersiveMode(getWindow().getDecorView());
126 } else {
127 getActivityTab().getTabWebContentsDelegateAndroid().setDisplayMode(
128 WebDisplayMode.Standalone);
129 }
124 } 130 }
125 131
126 @Override 132 @Override
127 public void preInflationStartup() { 133 public void preInflationStartup() {
128 WebappInfo info = createWebappInfo(getIntent()); 134 WebappInfo info = createWebappInfo(getIntent());
129 135
130 String id = ""; 136 String id = "";
131 if (info != null) { 137 if (info != null) {
132 mWebappInfo = info; 138 mWebappInfo = info;
133 id = info.id(); 139 id = info.id();
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 return new WebappDelegateFactory(this); 589 return new WebappDelegateFactory(this);
584 } 590 }
585 591
586 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950) 592 // We're temporarily disable CS on webapp since there are some issues. (http ://crbug.com/471950)
587 // TODO(changwan): re-enable it once the issues are resolved. 593 // TODO(changwan): re-enable it once the issues are resolved.
588 @Override 594 @Override
589 protected boolean isContextualSearchAllowed() { 595 protected boolean isContextualSearchAllowed() {
590 return false; 596 return false;
591 } 597 }
592 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698