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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 1509713004: Add a default share button to the menu of Custom Tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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.customtabs; 5 package org.chromium.chrome.browser.customtabs;
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.net.Uri; 9 import android.net.Uri;
10 import android.os.IBinder; 10 import android.os.IBinder;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 getActivityTab().loadUrl(new LoadUrlParams(searchUrl)); 359 getActivityTab().loadUrl(new LoadUrlParams(searchUrl));
360 } 360 }
361 361
362 @Override 362 @Override
363 public TabModelSelectorImpl getTabModelSelector() { 363 public TabModelSelectorImpl getTabModelSelector() {
364 return (TabModelSelectorImpl) super.getTabModelSelector(); 364 return (TabModelSelectorImpl) super.getTabModelSelector();
365 } 365 }
366 366
367 @Override 367 @Override
368 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { 368 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() {
369 return new CustomTabAppMenuPropertiesDelegate(this, mIntentDataProvider. getMenuTitles()); 369 return new CustomTabAppMenuPropertiesDelegate(this, mIntentDataProvider. getMenuTitles(),
370 mIntentDataProvider.shouldShowShareMenuItem());
370 } 371 }
371 372
372 @Override 373 @Override
373 protected int getAppMenuLayoutId() { 374 protected int getAppMenuLayoutId() {
374 return R.menu.custom_tabs_menu; 375 return R.menu.custom_tabs_menu;
375 } 376 }
376 377
377 @Override 378 @Override
378 protected int getControlContainerLayoutId() { 379 protected int getControlContainerLayoutId() {
379 return R.layout.custom_tabs_control_container; 380 return R.layout.custom_tabs_control_container;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 @Override 447 @Override
447 protected void showAppMenuForKeyboardEvent() { 448 protected void showAppMenuForKeyboardEvent() {
448 if (!shouldShowAppMenu()) return; 449 if (!shouldShowAppMenu()) return;
449 super.showAppMenuForKeyboardEvent(); 450 super.showAppMenuForKeyboardEvent();
450 } 451 }
451 452
452 @Override 453 @Override
453 public boolean onOptionsItemSelected(MenuItem item) { 454 public boolean onOptionsItemSelected(MenuItem item) {
454 int menuIndex = getAppMenuPropertiesDelegate().getIndexOfMenuItem(item); 455 int menuIndex = getAppMenuPropertiesDelegate().getIndexOfMenuItem(item);
455 if (menuIndex >= 0) { 456 if (menuIndex >= 0) {
456 mIntentDataProvider.clickMenuItemWithUrl(getApplicationContext(), me nuIndex, 457 mIntentDataProvider.clickMenuItemWithUrl(this, menuIndex,
457 getTabModelSelector().getCurrentTab().getUrl()); 458 getTabModelSelector().getCurrentTab().getUrl());
458 RecordUserAction.record("CustomTabsMenuCustomMenuItem"); 459 RecordUserAction.record("CustomTabsMenuCustomMenuItem");
459 return true; 460 return true;
460 } 461 }
461 return super.onOptionsItemSelected(item); 462 return super.onOptionsItemSelected(item);
462 } 463 }
463 464
464 @Override 465 @Override
465 public boolean dispatchKeyEvent(KeyEvent event) { 466 public boolean dispatchKeyEvent(KeyEvent event) {
466 Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this, 467 Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 533
533 /** 534 /**
534 * @return The {@link CustomTabIntentDataProvider} for this {@link CustomTab Activity}. For test 535 * @return The {@link CustomTabIntentDataProvider} for this {@link CustomTab Activity}. For test
535 * purposes only. 536 * purposes only.
536 */ 537 */
537 @VisibleForTesting 538 @VisibleForTesting
538 CustomTabIntentDataProvider getIntentDataProvider() { 539 CustomTabIntentDataProvider getIntentDataProvider() {
539 return mIntentDataProvider; 540 return mIntentDataProvider;
540 } 541 }
541 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698