TabStripModel::GetActiveWebContents() might return NULL, and will cause a crash if...
[chromium-blink-merge.git] / chrome / common / search_urls.cc
blobb1277b62e91fdaf40fdae3d25e8fdc83b99e7f2c
1 // Copyright 2013 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.
5 #include "chrome/common/search_urls.h"
7 #include "content/public/common/url_constants.h"
8 #include "url/gurl.h"
10 namespace search {
12 namespace {
13 bool MatchesOrigin(const GURL& my_url, const GURL& other_url) {
14 return my_url.host() == other_url.host() &&
15 my_url.port() == other_url.port() &&
16 (my_url.scheme() == other_url.scheme() ||
17 (my_url.SchemeIs(url::kHttpsScheme) &&
18 other_url.SchemeIs(url::kHttpScheme)));
20 } // namespace
22 bool MatchesOriginAndPath(const GURL& my_url, const GURL& other_url) {
23 return MatchesOrigin(my_url, other_url) && my_url.path() == other_url.path();
26 } // namespace search