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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java

Issue 199733002: Cleanup AppMenu code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move lint suppression to AppMenuDragHelper Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
index ab0c269b38c8a4b942c9bf8d7b1a2287c8e5a6ec..6e4a4e04b15fb73fe8d1eca88437d05ae3829be7 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
@@ -49,26 +49,46 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
/**
* Factory used to set up a mock ActivityWindowAndroid for testing.
*/
- public interface WindowAndroidFactoryForTest {
+ public interface ActivityWindowAndroidFactory {
/**
* @return ActivityWindowAndroid for the given activity.
*/
public ActivityWindowAndroid getActivityWindowAndroid(Activity activity);
}
- private static WindowAndroidFactoryForTest sWindowAndroidFactory =
- new WindowAndroidFactoryForTest() {
+ private static ActivityWindowAndroidFactory sWindowAndroidFactory =
+ new ActivityWindowAndroidFactory() {
@Override
public ActivityWindowAndroid getActivityWindowAndroid(Activity activity) {
return new ActivityWindowAndroid(activity);
}
};
+
private WindowAndroid mWindow;
private TabManager mTabManager;
private DevToolsServer mDevToolsServer;
private SyncController mSyncController;
private PrintingController mPrintingController;
+ /**
+ * Factory used to set up a mock AppMenuHandler for testing.
+ */
+ public interface AppMenuHandlerFactory {
+ /**
+ * @return AppMenuHandler for the given activity and menu resource id.
+ */
+ public AppMenuHandler getAppMenuHandler(Activity activity,
+ AppMenuPropertiesDelegate delegate, int menuResourceId);
+ }
+
+ private static AppMenuHandlerFactory sAppMenuHandlerFactory =
+ new AppMenuHandlerFactory() {
+ @Override
+ public AppMenuHandler getAppMenuHandler(Activity activity,
+ AppMenuPropertiesDelegate delegate, int menuResourceId) {
+ return new AppMenuHandler(activity, delegate, menuResourceId);
+ }
+ };
private AppMenuHandler mAppMenuHandler;
@Override
@@ -117,7 +137,7 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
mTabManager.setStartupUrl(startupUrl);
}
ChromeShellToolbar mToolbar = (ChromeShellToolbar) findViewById(R.id.toolbar);
- mAppMenuHandler = new AppMenuHandler(this, this, R.menu.main_menu);
+ mAppMenuHandler = sAppMenuHandlerFactory.getAppMenuHandler(this, this, R.menu.main_menu);
mToolbar.setMenuHandler(mAppMenuHandler);
mDevToolsServer = new DevToolsServer("chrome_shell");
@@ -315,6 +335,11 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
menu.setGroupVisible(R.id.MAIN_MENU, true);
}
+ @VisibleForTesting
+ public AppMenuHandler getAppMenuHandler() {
+ return mAppMenuHandler;
+ }
+
@Override
public boolean shouldShowIconRow() {
return true;
@@ -335,7 +360,12 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
}
@VisibleForTesting
- public static void setActivityWindowAndroidFactory(WindowAndroidFactoryForTest factory) {
+ public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFactory factory) {
sWindowAndroidFactory = factory;
}
+
+ @VisibleForTesting
+ public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) {
+ sAppMenuHandlerFactory = factory;
+ }
}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698