| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <ostream> | 5 #include <ostream> |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" |
| 9 #include "webkit/glue/web_intent_service_data.h" | 9 #include "webkit/glue/web_intent_service_data.h" |
| 10 | 10 |
| 11 namespace webkit_glue { | 11 namespace webkit_glue { |
| 12 | 12 |
| 13 static const char kIntentsInlineDisposition[] = "inline"; | 13 static const char kIntentsInlineDisposition[] = "inline"; |
| 14 | 14 |
| 15 WebIntentServiceData::WebIntentServiceData() | 15 WebIntentServiceData::WebIntentServiceData() |
| 16 : disposition(WebIntentServiceData::DISPOSITION_WINDOW) { | 16 : disposition(WebIntentServiceData::DISPOSITION_WINDOW) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 WebIntentServiceData::WebIntentServiceData(const GURL& svc_url, | 19 WebIntentServiceData::WebIntentServiceData(const string16& svc_action, |
| 20 const string16& svc_action, | |
| 21 const string16& svc_type, | 20 const string16& svc_type, |
| 21 const string16& svc_scheme, |
| 22 const GURL& svc_service_url, |
| 22 const string16& svc_title) | 23 const string16& svc_title) |
| 23 : service_url(svc_url), | 24 : action(svc_action), |
| 24 action(svc_action), | |
| 25 type(svc_type), | 25 type(svc_type), |
| 26 scheme(svc_scheme), |
| 27 service_url(svc_service_url), |
| 26 title(svc_title), | 28 title(svc_title), |
| 27 disposition(WebIntentServiceData::DISPOSITION_WINDOW) { | 29 disposition(WebIntentServiceData::DISPOSITION_WINDOW) { |
| 28 } | 30 } |
| 29 | 31 |
| 30 WebIntentServiceData::WebIntentServiceData( | 32 WebIntentServiceData::WebIntentServiceData( |
| 31 const WebKit::WebIntentServiceInfo& info) | 33 const WebKit::WebIntentServiceInfo& info) |
| 32 : service_url(info.url()), | 34 : action(info.action()), |
| 33 action(info.action()), | |
| 34 type(info.type()), | 35 type(info.type()), |
| 36 scheme(string16()), |
| 37 service_url(info.url()), |
| 35 title(info.title()), | 38 title(info.title()), |
| 36 disposition(WebIntentServiceData::DISPOSITION_WINDOW) { | 39 disposition(WebIntentServiceData::DISPOSITION_WINDOW) { |
| 37 setDisposition(info.disposition()); | 40 setDisposition(info.disposition()); |
| 38 } | 41 } |
| 39 | 42 |
| 40 WebIntentServiceData::~WebIntentServiceData() {} | 43 WebIntentServiceData::~WebIntentServiceData() {} |
| 41 | 44 |
| 42 bool WebIntentServiceData::operator==(const WebIntentServiceData& other) const { | 45 bool WebIntentServiceData::operator==(const WebIntentServiceData& other) const { |
| 43 return service_url == other.service_url && | 46 return action == other.action && |
| 44 action == other.action && | |
| 45 type == other.type && | 47 type == other.type && |
| 48 scheme == other.scheme && |
| 49 service_url == other.service_url && |
| 46 title == other.title && | 50 title == other.title && |
| 47 disposition == other.disposition; | 51 disposition == other.disposition; |
| 48 } | 52 } |
| 49 | 53 |
| 50 void WebIntentServiceData::setDisposition(const string16& disp) { | 54 void WebIntentServiceData::setDisposition(const string16& disp) { |
| 51 if (disp == ASCIIToUTF16(webkit_glue::kIntentsInlineDisposition)) | 55 if (disp == ASCIIToUTF16(webkit_glue::kIntentsInlineDisposition)) |
| 52 disposition = DISPOSITION_INLINE; | 56 disposition = DISPOSITION_INLINE; |
| 53 else | 57 else |
| 54 disposition = DISPOSITION_WINDOW; | 58 disposition = DISPOSITION_WINDOW; |
| 55 } | 59 } |
| 56 | 60 |
| 57 std::ostream& operator<<(::std::ostream& os, | 61 std::ostream& operator<<(::std::ostream& os, |
| 58 const WebIntentServiceData& intent) { | 62 const WebIntentServiceData& intent) { |
| 59 return os << | 63 return os << |
| 60 "{" << intent.service_url << | 64 "{action=" << UTF16ToUTF8(intent.action) << |
| 61 ", " << UTF16ToUTF8(intent.action) << | 65 "type=, " << UTF16ToUTF8(intent.type) << |
| 62 ", " << UTF16ToUTF8(intent.type) << | 66 "scheme=, " << UTF16ToUTF8(intent.scheme) << |
| 63 ", " << UTF16ToUTF8(intent.title) << | 67 "service_url=, " << intent.service_url << |
| 64 ", " << intent.disposition << | 68 "title=, " << UTF16ToUTF8(intent.title) << |
| 69 "disposition=, " << intent.disposition << |
| 65 "}"; | 70 "}"; |
| 66 } | 71 } |
| 67 | 72 |
| 68 } // namespace webkit_glue | 73 } // namespace webkit_glue |
| OLD | NEW |