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..0b251f15d9c0ad6589dd31084c872ac579865899 |
--- /dev/null |
+++ b/ash/cast_config_delegate.h |
@@ -0,0 +1,87 @@ |
+// 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; |
+ }; |
jennyz
2015/05/07 21:50:34
Add a blank line.
jdufault
2015/05/07 23:41:53
Done.
|
+ struct ASH_EXPORT Activity { |
+ // The tab identifier that we are casting. These are the special tab values |
+ // taken from the chromecast extension itself. If an actual tab is being |
+ // casted, then the TabId will be >= 0. |
+ enum TabId { |
+ 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, |
+ // or a value >= 0 that represents that tab index of the tab we are |
+ // casting. We default to casting the desktop, as a tab may not |
+ // necessarily exist. |
+ int tab_id = TabId::DESKTOP; |
jennyz
2015/05/07 21:50:34
How about initialize it in its constructor?
jdufault
2015/05/07 23:41:52
Why?
jennyz
2015/05/08 18:01:15
I typically looks into constructor for the default
achuithb
2015/05/08 18:19:44
This has also changed with C++11. We're now suppos
jennyz
2015/05/08 20:39:27
Acknowledged.
|
+ }; |
jennyz
2015/05/07 21:50:34
ditto
jdufault
2015/05/07 23:41:53
Why?
jennyz
2015/05/08 18:01:15
It looks neat between two structs.
|
+ struct ASH_EXPORT ReceiverAndActivity { |
+ ReceiverAndActivity(); |
+ ~ReceiverAndActivity(); |
+ |
+ Receiver receiver; |
+ Activity activity; |
+ }; |
jennyz
2015/05/07 21:50:35
ditto
jdufault
2015/05/07 23:41:53
Done.
|
+ using ReceiversAndActivites = std::map<std::string, ReceiverAndActivity>; |
jennyz
2015/05/07 21:50:35
Use typedef instead of using? Also, can you add a
jdufault
2015/05/07 23:41:52
Done for comment.
Style guide says that using is
jennyz
2015/05/08 18:01:15
Can you point me the Google or chromium c++ coding
achuithb
2015/05/08 18:12:19
Jenny, using instead of a typedef for type alias i
jennyz
2015/05/08 20:39:27
Acknowledged.
|
+ using ReceiversAndActivitesCallback = |
+ base::Callback<void(const ReceiversAndActivites&)>; |
jennyz
2015/05/07 21:50:34
typedef instead?
jdufault
2015/05/07 23:41:53
See above.
|
+ |
+ virtual ~CastConfigDelegate(); |
+ |
+ // Returns true if cast extension is installed. |
+ virtual bool HasCastExtension() = 0; |
+ // Returns the list of cast receivers and activities. |
jennyz
2015/05/07 21:50:35
The function does not return list of the cast rece
jdufault
2015/05/07 23:41:53
Done.
|
+ virtual void GetReceiversAndActivities( |
+ const ReceiversAndActivitesCallback& callback) = 0; |
+ // Cast to a device. |
jennyz
2015/05/07 21:50:35
Please explain what |receiver_id| specifies.
jdufault
2015/05/07 23:41:52
Done.
|
+ virtual void CastToReceiver(const std::string& receiver_id) = 0; |
+ // Stop ongoing cast. |
jennyz
2015/05/07 21:50:34
ditto.
jdufault
2015/05/07 23:41:53
Done.
|
+ 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_ |