| Index: net/base/url_util.cc
|
| diff --git a/chrome/common/net/url_util.cc b/net/base/url_util.cc
|
| similarity index 62%
|
| copy from chrome/common/net/url_util.cc
|
| copy to net/base/url_util.cc
|
| index 9d58317d09fd12dad126ad84bedd7ede083f4c75..99dbbbec67f3909c359bf25c7932414d8c18323d 100644
|
| --- a/chrome/common/net/url_util.cc
|
| +++ b/net/base/url_util.cc
|
| @@ -1,36 +1,14 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// 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/net/url_util.h"
|
| +#include "net/base/url_util.h"
|
|
|
| -#include "base/string_util.h"
|
| -#include "base/utf_string_conversions.h"
|
| -#include "chrome/common/url_constants.h"
|
| +#include "base/string_piece.h"
|
| #include "googleurl/src/gurl.h"
|
| -#include "googleurl/src/url_parse.h"
|
| #include "net/base/escape.h"
|
| -#include "net/base/net_util.h"
|
| -#include "ui/base/clipboard/scoped_clipboard_writer.h"
|
|
|
| -namespace chrome_common_net {
|
| -
|
| -void WriteURLToClipboard(const GURL& url,
|
| - const std::string& languages,
|
| - ui::Clipboard *clipboard) {
|
| - if (url.is_empty() || !url.is_valid() || !clipboard)
|
| - return;
|
| -
|
| - // Unescaping path and query is not a good idea because other applications
|
| - // may not encode non-ASCII characters in UTF-8. See crbug.com/2820.
|
| - string16 text = url.SchemeIs(chrome::kMailToScheme) ?
|
| - ASCIIToUTF16(url.path()) :
|
| - net::FormatUrl(url, languages, net::kFormatUrlOmitNothing,
|
| - net::UnescapeRule::NONE, NULL, NULL, NULL);
|
| -
|
| - ui::ScopedClipboardWriter scw(clipboard, ui::Clipboard::BUFFER_STANDARD);
|
| - scw.WriteURL(text);
|
| -}
|
| +namespace net {
|
|
|
| GURL AppendQueryParameter(const GURL& url,
|
| const std::string& name,
|
| @@ -40,8 +18,8 @@ GURL AppendQueryParameter(const GURL& url,
|
| if (!query.empty())
|
| query += "&";
|
|
|
| - query += (net::EscapeQueryParamValue(name, true) + "=" +
|
| - net::EscapeQueryParamValue(value, true));
|
| + query += (EscapeQueryParamValue(name, true) + "=" +
|
| + EscapeQueryParamValue(value, true));
|
| GURL::Replacements replacements;
|
| replacements.SetQueryStr(query);
|
| return url.ReplaceComponents(replacements);
|
| @@ -51,8 +29,8 @@ GURL AppendOrReplaceQueryParameter(const GURL& url,
|
| const std::string& name,
|
| const std::string& value) {
|
| bool replaced = false;
|
| - std::string param_name = net::EscapeQueryParamValue(name, true);
|
| - std::string param_value = net::EscapeQueryParamValue(value, true);
|
| + std::string param_name = EscapeQueryParamValue(name, true);
|
| + std::string param_value = EscapeQueryParamValue(value, true);
|
|
|
| const std::string input = url.query();
|
| url_parse::Component cursor(0, input.size());
|
| @@ -101,11 +79,11 @@ bool GetValueForKeyInQuery(const GURL& url,
|
| std::string key_string = url.spec().substr(key.begin, key.len);
|
| if (key_string == search_key) {
|
| if (value.is_nonempty()) {
|
| - *out_value = net::UnescapeURLComponent(
|
| + *out_value = UnescapeURLComponent(
|
| url.spec().substr(value.begin, value.len),
|
| - net::UnescapeRule::SPACES |
|
| - net::UnescapeRule::URL_SPECIAL_CHARS |
|
| - net::UnescapeRule::REPLACE_PLUS_WITH_SPACE);
|
| + UnescapeRule::SPACES |
|
| + UnescapeRule::URL_SPECIAL_CHARS |
|
| + UnescapeRule::REPLACE_PLUS_WITH_SPACE);
|
| } else {
|
| *out_value = "";
|
| }
|
| @@ -116,4 +94,4 @@ bool GetValueForKeyInQuery(const GURL& url,
|
| return false;
|
| }
|
|
|
| -} // namespace chrome_common_net
|
| +} // namespace net
|
|
|