OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.shell; | 5 package org.chromium.chrome.shell; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
11 import android.util.Log; | 11 import android.util.Log; |
12 import android.view.KeyEvent; | 12 import android.view.KeyEvent; |
13 import android.view.Menu; | 13 import android.view.Menu; |
14 import android.view.MenuItem; | 14 import android.view.MenuItem; |
15 import android.view.View; | 15 import android.view.View; |
| 16 import android.view.ViewGroup; |
16 import android.widget.Toast; | 17 import android.widget.Toast; |
17 | 18 |
18 import org.chromium.base.ApiCompatibilityUtils; | 19 import org.chromium.base.ApiCompatibilityUtils; |
19 import org.chromium.base.BaseSwitches; | 20 import org.chromium.base.BaseSwitches; |
20 import org.chromium.base.CommandLine; | 21 import org.chromium.base.CommandLine; |
21 import org.chromium.base.ContentUriUtils; | 22 import org.chromium.base.ContentUriUtils; |
22 import org.chromium.base.MemoryPressureListener; | 23 import org.chromium.base.MemoryPressureListener; |
23 import org.chromium.base.VisibleForTesting; | 24 import org.chromium.base.VisibleForTesting; |
24 import org.chromium.base.library_loader.ProcessInitException; | 25 import org.chromium.base.library_loader.ProcessInitException; |
25 import org.chromium.chrome.browser.DevToolsServer; | 26 import org.chromium.chrome.browser.DevToolsServer; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 mAppMenuHandler.showAppMenu(findViewById(R.id.menu_button), true, fa
lse); | 285 mAppMenuHandler.showAppMenu(findViewById(R.id.menu_button), true, fa
lse); |
285 return true; | 286 return true; |
286 } | 287 } |
287 return super.onKeyDown(keyCode, event); | 288 return super.onKeyDown(keyCode, event); |
288 } | 289 } |
289 | 290 |
290 @SuppressWarnings("deprecation") | 291 @SuppressWarnings("deprecation") |
291 @Override | 292 @Override |
292 public boolean onOptionsItemSelected(MenuItem item) { | 293 public boolean onOptionsItemSelected(MenuItem item) { |
293 ChromeShellTab activeTab = getActiveTab(); | 294 ChromeShellTab activeTab = getActiveTab(); |
| 295 if (activeTab != null) { |
| 296 ViewGroup containerView = activeTab.getContentViewCore().getContaine
rView(); |
| 297 if (containerView.isFocusable() && containerView.isFocusableInTouchM
ode()) { |
| 298 containerView.requestFocus(); |
| 299 } |
| 300 } |
294 switch (item.getItemId()) { | 301 switch (item.getItemId()) { |
295 case R.id.signin: | 302 case R.id.signin: |
296 if (ChromeSigninController.get(this).isSignedIn()) { | 303 if (ChromeSigninController.get(this).isSignedIn()) { |
297 SyncController.openSignOutDialog(getFragmentManager()); | 304 SyncController.openSignOutDialog(getFragmentManager()); |
298 } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { | 305 } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { |
299 SyncController.openSigninDialog(getFragmentManager()); | 306 SyncController.openSigninDialog(getFragmentManager()); |
300 } else { | 307 } else { |
301 Toast.makeText(this, R.string.signin_no_account, Toast.LENGT
H_SHORT).show(); | 308 Toast.makeText(this, R.string.signin_no_account, Toast.LENGT
H_SHORT).show(); |
302 } | 309 } |
303 return true; | 310 return true; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 @VisibleForTesting | 407 @VisibleForTesting |
401 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { | 408 public static void setActivityWindowAndroidFactory(ActivityWindowAndroidFact
ory factory) { |
402 sWindowAndroidFactory = factory; | 409 sWindowAndroidFactory = factory; |
403 } | 410 } |
404 | 411 |
405 @VisibleForTesting | 412 @VisibleForTesting |
406 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { | 413 public static void setAppMenuHandlerFactory(AppMenuHandlerFactory factory) { |
407 sAppMenuHandlerFactory = factory; | 414 sAppMenuHandlerFactory = factory; |
408 } | 415 } |
409 } | 416 } |
OLD | NEW |