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.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.support.v4.view.MenuItemCompat; | 10 import android.support.v4.view.MenuItemCompat; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 /** | 425 /** |
426 * Restablishes the chromotocast message channel, so we can continue communi
cating with the | 426 * Restablishes the chromotocast message channel, so we can continue communi
cating with the |
427 * Google Cast device. This must be called when resuming a connection. | 427 * Google Cast device. This must be called when resuming a connection. |
428 */ | 428 */ |
429 private void reconnectChannels() { | 429 private void reconnectChannels() { |
430 if (mApiClient == null && mChromotocastChannel == null) { | 430 if (mApiClient == null && mChromotocastChannel == null) { |
431 return; | 431 return; |
432 } | 432 } |
433 try { | 433 try { |
434 Cast.CastApi.setMessageReceivedCallbacks( | 434 Cast.CastApi.setMessageReceivedCallbacks( |
435 mApiClient,mChromotocastChannel.getNamespace(),mChromotocast
Channel); | 435 mApiClient, mChromotocastChannel.getNamespace(), mChromotoca
stChannel); |
436 sendPendingMessagesToCastDevice(); | 436 sendPendingMessagesToCastDevice(); |
437 } catch (IOException e) { | 437 } catch (IOException e) { |
438 showToast(R.string.connection_to_cast_failed, Toast.LENGTH_SHORT); | 438 showToast(R.string.connection_to_cast_failed, Toast.LENGTH_SHORT); |
439 } catch (IllegalStateException e) { | 439 } catch (IllegalStateException e) { |
440 showToast(R.string.connection_to_cast_failed, Toast.LENGTH_SHORT); | 440 showToast(R.string.connection_to_cast_failed, Toast.LENGTH_SHORT); |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 /** | 444 /** |
445 * Stops the running application on the Google Cast device and performs the
required tearDown | 445 * Stops the running application on the Google Cast device and performs the
required tearDown |
(...skipping 22 matching lines...) Expand all Loading... |
468 | 468 |
469 /** | 469 /** |
470 * Makes a toast using the given message and duration. | 470 * Makes a toast using the given message and duration. |
471 */ | 471 */ |
472 private void showToast(int messageId, int duration) { | 472 private void showToast(int messageId, int duration) { |
473 if (mContext != null) { | 473 if (mContext != null) { |
474 Toast.makeText(mContext, mContext.getString(messageId), duration).sh
ow(); | 474 Toast.makeText(mContext, mContext.getString(messageId), duration).sh
ow(); |
475 } | 475 } |
476 } | 476 } |
477 } | 477 } |
OLD | NEW |