OLD | NEW |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 mTab.loadUrl(new LoadUrlParams(searchUrl)); | 350 mTab.loadUrl(new LoadUrlParams(searchUrl)); |
351 } | 351 } |
352 | 352 |
353 @Override | 353 @Override |
354 public SingleTabModelSelector getTabModelSelector() { | 354 public SingleTabModelSelector getTabModelSelector() { |
355 return (SingleTabModelSelector) super.getTabModelSelector(); | 355 return (SingleTabModelSelector) super.getTabModelSelector(); |
356 } | 356 } |
357 | 357 |
358 @Override | 358 @Override |
359 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { | 359 protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { |
360 return new CustomTabAppMenuPropertiesDelegate(this, mIntentDataProvider.
getMenuTitles()); | 360 return new CustomTabAppMenuPropertiesDelegate(this, mIntentDataProvider.
getMenuTitles(), |
| 361 mIntentDataProvider.shouldShowShareButton()); |
361 } | 362 } |
362 | 363 |
363 @Override | 364 @Override |
364 protected int getAppMenuLayoutId() { | 365 protected int getAppMenuLayoutId() { |
365 return R.menu.custom_tabs_menu; | 366 return R.menu.custom_tabs_menu; |
366 } | 367 } |
367 | 368 |
368 @Override | 369 @Override |
369 protected int getControlContainerLayoutId() { | 370 protected int getControlContainerLayoutId() { |
370 return R.layout.custom_tabs_control_container; | 371 return R.layout.custom_tabs_control_container; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 @Override | 436 @Override |
436 protected void showAppMenuForKeyboardEvent() { | 437 protected void showAppMenuForKeyboardEvent() { |
437 if (!shouldShowAppMenu()) return; | 438 if (!shouldShowAppMenu()) return; |
438 super.showAppMenuForKeyboardEvent(); | 439 super.showAppMenuForKeyboardEvent(); |
439 } | 440 } |
440 | 441 |
441 @Override | 442 @Override |
442 public boolean onOptionsItemSelected(MenuItem item) { | 443 public boolean onOptionsItemSelected(MenuItem item) { |
443 int menuIndex = getAppMenuPropertiesDelegate().getIndexOfMenuItem(item); | 444 int menuIndex = getAppMenuPropertiesDelegate().getIndexOfMenuItem(item); |
444 if (menuIndex >= 0) { | 445 if (menuIndex >= 0) { |
445 mIntentDataProvider.clickMenuItemWithUrl(getApplicationContext(), me
nuIndex, | 446 mIntentDataProvider.clickMenuItemWithUrl(this, menuIndex, |
446 getTabModelSelector().getCurrentTab().getUrl()); | 447 getTabModelSelector().getCurrentTab().getUrl()); |
447 RecordUserAction.record("CustomTabsMenuCustomMenuItem"); | 448 RecordUserAction.record("CustomTabsMenuCustomMenuItem"); |
448 return true; | 449 return true; |
449 } | 450 } |
450 return super.onOptionsItemSelected(item); | 451 return super.onOptionsItemSelected(item); |
451 } | 452 } |
452 | 453 |
453 @Override | 454 @Override |
454 public boolean dispatchKeyEvent(KeyEvent event) { | 455 public boolean dispatchKeyEvent(KeyEvent event) { |
455 Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this, | 456 Boolean result = KeyboardShortcuts.dispatchKeyEvent(event, this, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 518 |
518 /** | 519 /** |
519 * @return The {@link CustomTabIntentDataProvider} for this {@link CustomTab
Activity}. For test | 520 * @return The {@link CustomTabIntentDataProvider} for this {@link CustomTab
Activity}. For test |
520 * purposes only. | 521 * purposes only. |
521 */ | 522 */ |
522 @VisibleForTesting | 523 @VisibleForTesting |
523 CustomTabIntentDataProvider getIntentDataProvider() { | 524 CustomTabIntentDataProvider getIntentDataProvider() { |
524 return mIntentDataProvider; | 525 return mIntentDataProvider; |
525 } | 526 } |
526 } | 527 } |
OLD | NEW |