Chromium Code Reviews| Index: chrome/browser/extensions/webstore_inline_installer.cc |
| diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc |
| index 598ca2b19176345d881fef9f26c85a4b37a0f1ec..e37a620488248100dd5303e04fac5f83b2f2a681 100644 |
| --- a/chrome/browser/extensions/webstore_inline_installer.cc |
| +++ b/chrome/browser/extensions/webstore_inline_installer.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2012 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. |
| @@ -18,6 +18,7 @@ |
| #include "chrome/common/extensions/extension.h" |
| #include "chrome/common/extensions/extension_constants.h" |
| #include "chrome/common/extensions/url_pattern.h" |
| +#include "chrome/common/url_constants.h" |
| #include "content/browser/utility_process_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/common/url_fetcher.h" |
| @@ -302,7 +303,24 @@ void WebstoreInlineInstaller::OnWebstoreResponseParseSuccess( |
| URLPattern verified_site_pattern(URLPattern::SCHEME_ALL); |
| verified_site_pattern.SetScheme("*"); |
| - verified_site_pattern.SetHost(verified_site_domain); |
|
jstritar
2012/01/23 21:37:28
URLPattern already handles a lot of this if you us
Mihai Parparita -not on Chrome
2012/01/25 00:53:24
Yeah, that ended up being easier, especially since
|
| + // Verified domains can have ports, so we have to parse them out. |
| + size_t host_end_pos = verified_site_domain.find(':'); |
| + if (host_end_pos == std::string::npos) { |
| + verified_site_pattern.SetHost(verified_site_domain); |
| + } else { |
| + std::string verified_site_port = |
| + verified_site_domain.substr(host_end_pos + 1); |
| + // We temporarily set the scheme to be HTTP, since URLPattern doesn't |
| + // allow specific ports unless the scheme has a default port. |
|
jstritar
2012/01/23 21:37:28
Hm, strange, is this a bug?
Mihai Parparita -not on Chrome
2012/01/25 00:53:24
It appears to be intentional behavior (see IsValid
|
| + verified_site_pattern.SetScheme(chrome::kHttpScheme); |
| + if (!verified_site_pattern.SetPort(verified_site_port)) { |
| + CompleteInstall(kInvalidWebstoreResponseError); |
| + return; |
| + } |
| + verified_site_pattern.SetScheme("*"); |
| + verified_site_pattern.SetHost( |
| + verified_site_domain.substr(0, host_end_pos)); |
| + } |
| verified_site_pattern.SetMatchSubdomains(true); |
| verified_site_pattern.SetPath("/*"); |