Chromium Code Reviews| Index: chrome/common/search_urls.cc |
| diff --git a/chrome/common/search_urls.cc b/chrome/common/search_urls.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..98568429e5d2334348244c46976c1254fdfc6bc8 |
| --- /dev/null |
| +++ b/chrome/common/search_urls.cc |
| @@ -0,0 +1,26 @@ |
| +// Copyright 2013 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. |
| + |
| +#include "chrome/common/search_urls.h" |
| + |
| +#include "content/public/common/url_constants.h" |
| +#include "url/gurl.h" |
| + |
| +namespace search { |
|
samarth
2013/09/20 16:43:40
I think we should consider moving all of the utili
Jered
2013/09/20 20:55:49
I agree. I don't think the grab bag of functions e
|
| + |
| +namespace { |
| +bool MatchesOrigin(const GURL& my_url, const GURL& other_url) { |
| + return my_url.host() == other_url.host() && |
| + my_url.port() == other_url.port() && |
| + (my_url.scheme() == other_url.scheme() || |
| + (my_url.SchemeIs(content::kHttpsScheme) && |
| + other_url.SchemeIs(content::kHttpScheme))); |
| +} |
| +} // namespace |
| + |
| +bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) { |
|
samarth
2013/09/20 16:43:40
Unit test please.
Jered
2013/09/20 20:55:49
Done.
|
| + return MatchesOrigin(my_url, other_url) && my_url.path() == other_url.path(); |
| +} |
| + |
| +} // namespace search |