Chromium Code Reviews| Index: ash/cast_config_delegate.h |
| diff --git a/ash/cast_config_delegate.h b/ash/cast_config_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f9cccdd6191ccca384e268651b69093dba548c3b |
| --- /dev/null |
| +++ b/ash/cast_config_delegate.h |
| @@ -0,0 +1,81 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_CAST_CONFIG_DELEGATE_H_ |
| +#define ASH_CAST_CONFIG_DELEGATE_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "ash/ash_export.h" |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/strings/string16.h" |
| +#include "url/gurl.h" |
| + |
| +namespace ash { |
| + |
| +// This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|, |
| +// to access the cast extension. |
| +class CastConfigDelegate { |
| + public: |
| + struct ASH_EXPORT Receiver { |
| + Receiver(); |
| + ~Receiver(); |
| + |
| + std::string id; |
| + base::string16 name; |
| + }; |
| + struct ASH_EXPORT Activity { |
| + enum TabId { |
|
achuithb
2015/05/06 00:45:57
Please provide an explanation of how these values
jdufault
2015/05/06 19:02:55
Done.
|
| + EXTENSION = -1, |
| + DESKTOP = -2, |
| + DISCOVERED_ACTIVITY = -3, |
| + EXTERNAL_EXTENSION_CLIENT = -4 |
| + }; |
| + |
| + Activity(); |
| + ~Activity(); |
| + |
| + std::string id; |
| + base::string16 title; |
| + std::string activity_type; |
| + bool allow_stop = false; |
| + |
| + // The id for the tab we are casting. Could be one of the TabId values.:w |
|
achuithb
2015/05/06 00:45:57
Remove :w
jdufault
2015/05/06 19:02:55
Done.
|
| + int tab_id; |
|
achuithb
2015/05/06 00:45:57
should this have a default value?
jdufault
2015/05/06 19:02:55
Done.
|
| + }; |
| + struct ASH_EXPORT ReceiverAndActivity { |
| + ReceiverAndActivity(); |
| + ~ReceiverAndActivity(); |
| + |
| + Receiver receiver; |
| + Activity activity; |
| + }; |
| + using ReceiversAndActivites = std::map<std::string, ReceiverAndActivity>; |
| + using ReceiversAndActivitesCallback = |
| + base::Callback<void(const ReceiversAndActivites&)>; |
| + |
| + virtual ~CastConfigDelegate() {} |
|
achuithb
2015/05/06 00:45:57
Let's move the implementation to the .cc as well
jdufault
2015/05/06 19:02:55
Done.
|
| + |
| + // Returns true if cast extension is installed. |
| + virtual bool HasCastExtension() = 0; |
| + // Returns the list of cast receivers and activities. |
| + virtual void GetReceiversAndActivities( |
| + const ReceiversAndActivitesCallback& callback) = 0; |
| + // Cast to a device. |
| + virtual void CastToReceiver(const std::string& receiver_id) = 0; |
| + // Stop ongoing cast. |
| + virtual void StopCasting(const std::string& activity_id) = 0; |
| + // Opens Options page for cast. |
| + virtual void LaunchCastOptions() = 0; |
| + |
| + private: |
| + DISALLOW_ASSIGN(CastConfigDelegate); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_CAST_CONFIG_DELEGATE_H_ |