Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 } | 63 } |
| 64 | 64 |
| 65 DictionaryValue* ProtocolHandler::Encode() const { | 65 DictionaryValue* ProtocolHandler::Encode() const { |
| 66 DictionaryValue* d = new DictionaryValue(); | 66 DictionaryValue* d = new DictionaryValue(); |
| 67 d->Set("protocol", Value::CreateStringValue(protocol_)); | 67 d->Set("protocol", Value::CreateStringValue(protocol_)); |
| 68 d->Set("url", Value::CreateStringValue(url_.spec())); | 68 d->Set("url", Value::CreateStringValue(url_.spec())); |
| 69 d->Set("title", Value::CreateStringValue(title_)); | 69 d->Set("title", Value::CreateStringValue(title_)); |
| 70 return d; | 70 return d; |
| 71 } | 71 } |
| 72 | 72 |
| 73 std::string ProtocolHandler::ToString() const { | |
| 74 return std::string("{ ") + | |
|
Peter Kasting
2012/06/22 22:10:06
Nit: I'd probably write/wrap as:
return "{ prot
Steve McKay
2012/06/22 22:40:01
Sorry. Mailed before I compiled :(
Had to add som
| |
| 75 " protocol=" + protocol + | |
| 76 ", url=" + url + | |
| 77 ", title=" + title + | |
| 78 " }"; | |
| 79 } | |
| 80 | |
| 73 bool ProtocolHandler::operator==(const ProtocolHandler& other) const { | 81 bool ProtocolHandler::operator==(const ProtocolHandler& other) const { |
| 74 return protocol_ == other.protocol_ && | 82 return protocol_ == other.protocol_ && |
| 75 url_ == other.url_ && | 83 url_ == other.url_ && |
| 76 title_ == other.title_; | 84 title_ == other.title_; |
| 77 } | 85 } |
| 78 | 86 |
| 79 bool ProtocolHandler::IsEquivalent(const ProtocolHandler& other) const { | 87 bool ProtocolHandler::IsEquivalent(const ProtocolHandler& other) const { |
| 80 return protocol_ == other.protocol_ && url_ == other.url_; | 88 return protocol_ == other.protocol_ && url_ == other.url_; |
| 81 } | 89 } |
| 82 | 90 |
| 83 bool ProtocolHandler::operator<(const ProtocolHandler& other) const { | 91 bool ProtocolHandler::operator<(const ProtocolHandler& other) const { |
| 84 return title_ < other.title_; | 92 return title_ < other.title_; |
| 85 } | 93 } |
| OLD | NEW |