Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_CAST_CONFIG_DELEGATE_H_ | |
| 6 #define ASH_CAST_CONFIG_DELEGATE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "ash/ash_export.h" | |
| 12 #include "base/callback.h" | |
| 13 #include "base/macros.h" | |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/strings/string16.h" | |
| 16 #include "url/gurl.h" | |
| 17 | |
| 18 namespace ash { | |
| 19 | |
| 20 // This delegate allows the UI code in ash, e.g. |TrayCastDetailedView|, | |
| 21 // to access the cast extension. | |
| 22 class CastConfigDelegate { | |
| 23 public: | |
| 24 struct ASH_EXPORT Receiver { | |
| 25 Receiver(); | |
| 26 ~Receiver(); | |
| 27 | |
| 28 std::string id; | |
| 29 base::string16 name; | |
| 30 }; | |
|
jennyz
2015/05/07 21:50:34
Add a blank line.
jdufault
2015/05/07 23:41:53
Done.
| |
| 31 struct ASH_EXPORT Activity { | |
| 32 // The tab identifier that we are casting. These are the special tab values | |
| 33 // taken from the chromecast extension itself. If an actual tab is being | |
| 34 // casted, then the TabId will be >= 0. | |
| 35 enum TabId { | |
| 36 EXTENSION = -1, | |
| 37 DESKTOP = -2, | |
| 38 DISCOVERED_ACTIVITY = -3, | |
| 39 EXTERNAL_EXTENSION_CLIENT = -4 | |
| 40 }; | |
| 41 | |
| 42 Activity(); | |
| 43 ~Activity(); | |
| 44 | |
| 45 std::string id; | |
| 46 base::string16 title; | |
| 47 std::string activity_type; | |
| 48 bool allow_stop = false; | |
| 49 | |
| 50 // The id for the tab we are casting. Could be one of the TabId values, | |
| 51 // or a value >= 0 that represents that tab index of the tab we are | |
| 52 // casting. We default to casting the desktop, as a tab may not | |
| 53 // necessarily exist. | |
| 54 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.
| |
| 55 }; | |
|
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.
| |
| 56 struct ASH_EXPORT ReceiverAndActivity { | |
| 57 ReceiverAndActivity(); | |
| 58 ~ReceiverAndActivity(); | |
| 59 | |
| 60 Receiver receiver; | |
| 61 Activity activity; | |
| 62 }; | |
|
jennyz
2015/05/07 21:50:35
ditto
jdufault
2015/05/07 23:41:53
Done.
| |
| 63 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.
| |
| 64 using ReceiversAndActivitesCallback = | |
| 65 base::Callback<void(const ReceiversAndActivites&)>; | |
|
jennyz
2015/05/07 21:50:34
typedef instead?
jdufault
2015/05/07 23:41:53
See above.
| |
| 66 | |
| 67 virtual ~CastConfigDelegate(); | |
| 68 | |
| 69 // Returns true if cast extension is installed. | |
| 70 virtual bool HasCastExtension() = 0; | |
| 71 // 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.
| |
| 72 virtual void GetReceiversAndActivities( | |
| 73 const ReceiversAndActivitesCallback& callback) = 0; | |
| 74 // 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.
| |
| 75 virtual void CastToReceiver(const std::string& receiver_id) = 0; | |
| 76 // Stop ongoing cast. | |
|
jennyz
2015/05/07 21:50:34
ditto.
jdufault
2015/05/07 23:41:53
Done.
| |
| 77 virtual void StopCasting(const std::string& activity_id) = 0; | |
| 78 // Opens Options page for cast. | |
| 79 virtual void LaunchCastOptions() = 0; | |
| 80 | |
| 81 private: | |
| 82 DISALLOW_ASSIGN(CastConfigDelegate); | |
| 83 }; | |
| 84 | |
| 85 } // namespace ash | |
| 86 | |
| 87 #endif // ASH_CAST_CONFIG_DELEGATE_H_ | |
| OLD | NEW |