Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed)

Created:
4 years, 10 months ago by matt.boetger
Modified:
4 years, 8 months ago
Reviewers:
mark a. foltz, imcheng
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, darin (slow to review), extensions-reviews_chromium.org, feature-media-reviews_chromium.org, kalyank, mcasas+watch_chromium.org, media-router+watch_chromium.org, posciak+watch_chromium.org, qsr+mojo_chromium.org, rjkroege, sadrul, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Pass origin to StartObservingMediaSinks. The DIAL provider needs to whitelist requests based on the origin of the current page. To make this happen, the Media Router interface needs to be updated to pass the origin on the StartObservingMediaSinks call. BUG=

Patch Set 1 : Ready for Review #

Total comments: 17

Patch Set 2 : Minor Review Fixes without addressing caching #

Patch Set 3 : Cache off media source #

Total comments: 30

Patch Set 4 : Marks Review Fixes with URL changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+357 lines, -157 lines) Patch
M chrome/browser/media/android/router/media_router_dialog_controller_android.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/media/router/media_router.mojom View 1 2 3 2 chunks +7 lines, -3 lines 0 comments Download
M chrome/browser/media/router/media_router_mojo_impl.h View 1 2 4 chunks +6 lines, -3 lines 0 comments Download
M chrome/browser/media/router/media_router_mojo_impl.cc View 1 2 3 8 chunks +28 lines, -23 lines 0 comments Download
M chrome/browser/media/router/media_router_mojo_impl_unittest.cc View 1 2 3 8 chunks +44 lines, -19 lines 0 comments Download
M chrome/browser/media/router/media_sinks_observer.h View 1 2 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/media/router/media_source.h View 1 2 3 2 chunks +18 lines, -6 lines 0 comments Download
M chrome/browser/media/router/media_source.cc View 1 2 3 2 chunks +23 lines, -2 lines 0 comments Download
M chrome/browser/media/router/media_source_helper.h View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/media/router/media_source_helper.cc View 1 2 3 2 chunks +13 lines, -3 lines 0 comments Download
M chrome/browser/media/router/media_source_helper_unittest.cc View 1 2 3 4 chunks +16 lines, -7 lines 0 comments Download
M chrome/browser/media/router/mock_screen_availability_listener.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/media/router/presentation_media_sinks_observer.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/media/router/presentation_media_sinks_observer.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc View 1 2 3 chunks +30 lines, -8 lines 0 comments Download
M chrome/browser/media/router/presentation_request.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/media/router/presentation_service_delegate_impl.cc View 1 2 3 10 chunks +43 lines, -30 lines 0 comments Download
M chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc View 1 2 3 9 chunks +26 lines, -9 lines 0 comments Download
M chrome/browser/media/router/test_helper.h View 1 2 2 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/ui/ash/cast_config_delegate_media_router.cc View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/media_router/media_router_ui.cc View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/media_router/query_result_manager.h View 1 2 3 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/media_router/query_result_manager.cc View 1 2 1 chunk +5 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/media_router/query_result_manager_unittest.cc View 1 2 3 6 chunks +24 lines, -9 lines 0 comments Download
M chrome/test/media_router/media_router_e2e_browsertest.h View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M chrome/test/media_router/media_router_e2e_browsertest.cc View 1 2 3 4 chunks +7 lines, -7 lines 0 comments Download
M chrome/test/media_router/test_media_sinks_observer.h View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/test/media_router/test_media_sinks_observer.cc View 1 2 2 chunks +5 lines, -0 lines 0 comments Download
M extensions/renderer/resources/media_router_bindings.js View 1 2 3 2 chunks +20 lines, -6 lines 0 comments Download

Messages

Total messages: 31 (10 generated)
imcheng
A couple of high level comments. We need to make sure sink list results are ...
4 years, 10 months ago (2016-02-16 20:54:18 UTC) #7
mark a. foltz
A few minor comments. Re: Caching It would be better to combine cache results across ...
4 years, 10 months ago (2016-02-17 21:50:51 UTC) #8
imcheng (use chromium acct)
On 2016/02/17 21:50:51, mark a. foltz wrote: > A few minor comments. > > Re: ...
4 years, 10 months ago (2016-02-18 00:33:16 UTC) #9
imcheng (use chromium acct)
On 2016/02/18 00:33:16, imcheng wrote: > On 2016/02/17 21:50:51, mark a. foltz wrote: > > ...
4 years, 10 months ago (2016-02-18 00:40:33 UTC) #10
matt.boetger
I agree with Derek. I don't think there is a way of doing this without ...
4 years, 10 months ago (2016-02-18 00:50:33 UTC) #11
mark a. foltz
I think there's a consensus between Derek and I that we need to distinguish the ...
4 years, 10 months ago (2016-02-19 00:34:53 UTC) #12
matt.boetger
On 2016/02/19 00:34:53, mark a. foltz wrote: > I think there's a consensus between Derek ...
4 years, 10 months ago (2016-02-24 23:53:11 UTC) #13
mark a. foltz
On 2016/02/24 at 23:53:11, boetger wrote: > On 2016/02/19 00:34:53, mark a. foltz wrote: > ...
4 years, 10 months ago (2016-02-25 17:06:42 UTC) #14
chromium-reviews
As the owners of the API, I assumed you would want to propose the changes. ...
4 years, 10 months ago (2016-02-25 17:57:56 UTC) #15
imcheng
Okay, I will take a stab at this. So continuing from the idea in #10 ...
4 years, 10 months ago (2016-02-25 19:18:36 UTC) #16
matt.boetger
To be clear, this would mean the app availability queries will run all the time, ...
4 years, 10 months ago (2016-02-25 19:31:52 UTC) #17
mark a. foltz
That seems reasonable, but a little complicated. Now that I have seen the whitelist, in ...
4 years, 10 months ago (2016-02-25 19:56:39 UTC) #18
imcheng
On 2016/02/25 19:56:39, mark a. foltz wrote: > That seems reasonable, but a little complicated. ...
4 years, 10 months ago (2016-02-25 20:28:02 UTC) #19
matt.boetger
On 2016/02/25 20:28:02, imcheng1 wrote: > On 2016/02/25 19:56:39, mark a. foltz wrote: > > ...
4 years, 10 months ago (2016-02-25 22:58:26 UTC) #20
matt.boetger
On 2016/02/25 20:28:02, imcheng1 wrote: > On 2016/02/25 19:56:39, mark a. foltz wrote: > > ...
4 years, 10 months ago (2016-02-25 22:58:29 UTC) #21
imcheng (use chromium acct)
On 2016/02/25 22:58:29, matt.boetger wrote: > On 2016/02/25 20:28:02, imcheng1 wrote: > > On 2016/02/25 ...
4 years, 10 months ago (2016-02-25 23:10:54 UTC) #22
matt.boetger
On 2016/02/25 23:10:54, imcheng wrote: > On 2016/02/25 22:58:29, matt.boetger wrote: > > On 2016/02/25 ...
4 years, 10 months ago (2016-02-26 01:59:24 UTC) #23
mark a. foltz
On 2016/02/26 at 01:59:24, boetger wrote: > On 2016/02/25 23:10:54, imcheng wrote: > > On ...
4 years, 10 months ago (2016-02-26 06:12:00 UTC) #24
matt.boetger
https://codereview.chromium.org/1693963003/diff/80001/chrome/browser/media/router/media_router_mojo_impl.h File chrome/browser/media/router/media_router_mojo_impl.h (right): https://codereview.chromium.org/1693963003/diff/80001/chrome/browser/media/router/media_router_mojo_impl.h#newcode333 chrome/browser/media/router/media_router_mojo_impl.h:333: base::ScopedPtrHashMap<MediaSource::Id, scoped_ptr<MediaSinksQuery>> On 2016/02/16 20:54:18, imcheng wrote: > since ...
4 years, 9 months ago (2016-03-03 05:42:22 UTC) #28
mark a. foltz
Please update the BUG= in the patch description when you get a chance. Overall looks ...
4 years, 9 months ago (2016-03-03 22:58:37 UTC) #29
matt.boetger
4 years, 9 months ago (2016-03-04 00:22:11 UTC) #31
I'm PTO Friday - Monday.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/media_router.mojom (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_router.mojom:218: // |origin| can be used to
optionally verify that the origin is
On 2016/03/03 22:58:36, mark a. foltz wrote:
> I would say:
> |origin| is the origin of the client that is requesting media sinks.
> It may be used to verify that |origin| is authorized to receive sinks for
> |media_source|.
>  

This is the second time you have suggested a change to this.  I will change it
this time, but any future change of your mind should require another CL to
prevent this from continuing ad nauseam.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_router.mojom:222: // Stops querying sinks for
|media_source|.
On 2016/03/03 22:58:36, mark a. foltz wrote:
> And:
> |origin| is the origin of the client that started the query.

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/media_router_mojo_impl_unittest.cc (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_router_mojo_impl_unittest.cc:488: 
On 2016/03/03 22:58:36, mark a. foltz wrote:
> Set an origin on media_source2?

Wanted to test not setting an origin for this one.  Should default to the empty
string tested below.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_router_mojo_impl_unittest.cc:548:
base::RunLoop run_loop3;
On 2016/03/03 22:58:36, mark a. foltz wrote:
> I want to clean up these test cases not to manage multiple run loops, it
creates
> code that is hard to maintain.
> 
> Can you try:
> - Creating one run loop here
> - Removing the code that calls Quit()
> - Call RunUntilIdle at the end of the test to run all pending tasks
> 

Perhaps that clean up could be in a different CL since there are multiple
methods that use multiple loops in this class and that cleanup has nothing to do
with this code change.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/media_source.h (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_source.h:30: std::string GetOrigin() const;
On 2016/03/03 22:58:36, mark a. foltz wrote:
> origin() for simple getters

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_source.h:33: void SetOrigin(std::string
origin);
On 2016/03/03 22:58:36, mark a. foltz wrote:
> set_origin() for simple setters

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/media_source_helper_unittest.cc (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/media_source_helper_unittest.cc:18:
IsMirroringMediaSource(MediaSourceForPresentationUrl("http://url",
On 2016/03/03 22:58:36, mark a. foltz wrote:
> Nit: Please use valid looking URLs and origins, like
> 
> "http://example.com/presentation.html", "http://example.com"
> 
> It makes the test easier to understand.

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/presentation_media_sinks_observer.cc (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/presentation_media_sinks_observer.cc:31: if
(!incomingSource.Equals(source()))
On 2016/03/03 22:58:36, mark a. foltz wrote:
> Derek: Should this be a DCHECK()?

This method WILL be called with other sources unless we don't want to use the
FOR_EACH_OBSERVER macros.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
File chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
(right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/media/r...
chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc:88:
std::string presentation_url1("http://foo.fakeUrl");
On 2016/03/03 22:58:36, mark a. foltz wrote:
> Similar comment about URLs/origins in tests.

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
File chrome/browser/ui/webui/media_router/query_result_manager.cc (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
chrome/browser/ui/webui/media_router/query_result_manager.cc:34: if
(!incomingSource.Equals(source())) {
On 2016/03/03 22:58:37, mark a. foltz wrote:
> Similar comment about DCHECK.  It seems like the observer is owned by the
frame
> which should not change origins?

Similar answer.  These will be called.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
File chrome/browser/ui/webui/media_router/query_result_manager.h (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
chrome/browser/ui/webui/media_router/query_result_manager.h:42: //      
MediaSourceForPresentationUrl("http://google.com"),
On 2016/03/03 22:58:37, mark a. foltz wrote:
> Make the presentation URL different from the origin, for clarity.

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
chrome/browser/ui/webui/media_router/query_result_manager.h:45: //      
MediaSourceForTab(123), GURL(""));
On 2016/03/03 22:58:37, mark a. foltz wrote:
> When would a sinks query not pass an origin?

For tabs.

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
File chrome/browser/ui/webui/media_router/query_result_manager_unittest.cc
(right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/browser/ui/webu...
chrome/browser/ui/webui/media_router/query_result_manager_unittest.cc:98:
"http://fooUrl.com"));
On 2016/03/03 22:58:37, mark a. foltz wrote:
> url != origin here and below

Done.

https://codereview.chromium.org/1693963003/diff/180001/chrome/test/media_rout...
File chrome/test/media_router/test_media_sinks_observer.cc (right):

https://codereview.chromium.org/1693963003/diff/180001/chrome/test/media_rout...
chrome/test/media_router/test_media_sinks_observer.cc:25: if
(!incomingSource.Equals(source())) {
On 2016/03/03 22:58:37, mark a. foltz wrote:
> DCHECK?

Same answer.

https://codereview.chromium.org/1693963003/diff/180001/extensions/renderer/re...
File extensions/renderer/resources/media_router_bindings.js (right):

https://codereview.chromium.org/1693963003/diff/180001/extensions/renderer/re...
extensions/renderer/resources/media_router_bindings.js:272:
this.service_.onSinksReceived(sourceUrn, origin, sinks.map(sinkToMojo_));
On 2016/03/03 22:58:37, mark a. foltz wrote:
> How will this handle an extension that does not use the new API?
> 
> Rather than sticking an optional argument on the end, I would use a type check
> on the second argument to determine which API is in use.

Done.

Powered by Google App Engine
This is Rietveld 408576698