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

Side by Side Diff: chrome/common/custom_handlers/protocol_handler.cc

Issue 7978039: net: Put more functions from escape.h into net namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/common/extensions/extension_constants.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/custom_handlers/protocol_handler.h" 5 #include "chrome/common/custom_handlers/protocol_handler.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "net/base/escape.h" 9 #include "net/base/escape.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 string16 title; 46 string16 title;
47 value->GetString("protocol", &protocol); 47 value->GetString("protocol", &protocol);
48 value->GetString("url", &url); 48 value->GetString("url", &url);
49 value->GetString("title", &title); 49 value->GetString("title", &title);
50 return ProtocolHandler::CreateProtocolHandler(protocol, GURL(url), title); 50 return ProtocolHandler::CreateProtocolHandler(protocol, GURL(url), title);
51 } 51 }
52 52
53 GURL ProtocolHandler::TranslateUrl(const GURL& url) const { 53 GURL ProtocolHandler::TranslateUrl(const GURL& url) const {
54 std::string translatedUrlSpec(url_.spec()); 54 std::string translatedUrlSpec(url_.spec());
55 ReplaceSubstringsAfterOffset(&translatedUrlSpec, 0, "%s", 55 ReplaceSubstringsAfterOffset(&translatedUrlSpec, 0, "%s",
56 EscapeQueryParamValue(url.spec(), true)); 56 net::EscapeQueryParamValue(url.spec(), true));
57 return GURL(translatedUrlSpec); 57 return GURL(translatedUrlSpec);
58 } 58 }
59 59
60 DictionaryValue* ProtocolHandler::Encode() const { 60 DictionaryValue* ProtocolHandler::Encode() const {
61 DictionaryValue* d = new DictionaryValue(); 61 DictionaryValue* d = new DictionaryValue();
62 d->Set("protocol", Value::CreateStringValue(protocol_)); 62 d->Set("protocol", Value::CreateStringValue(protocol_));
63 d->Set("url", Value::CreateStringValue(url_.spec())); 63 d->Set("url", Value::CreateStringValue(url_.spec()));
64 d->Set("title", Value::CreateStringValue(title_)); 64 d->Set("title", Value::CreateStringValue(title_));
65 return d; 65 return d;
66 } 66 }
67 67
68 bool ProtocolHandler::operator==(const ProtocolHandler& other) const { 68 bool ProtocolHandler::operator==(const ProtocolHandler& other) const {
69 return protocol_ == other.protocol_ && 69 return protocol_ == other.protocol_ &&
70 url_ == other.url_ && 70 url_ == other.url_ &&
71 title_ == other.title_; 71 title_ == other.title_;
72 } 72 }
73 73
74 bool ProtocolHandler::operator<(const ProtocolHandler& other) const { 74 bool ProtocolHandler::operator<(const ProtocolHandler& other) const {
75 return title_ < other.title_; 75 return title_ < other.title_;
76 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/common/extensions/extension_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698