blob: e9d8d561c220eb437b4bc848c5ba9e28a772b7a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2011 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 <ostream>
#include "base/utf_string_conversions.h"
#include "webkit/glue/web_intent_service_data.h"
namespace webkit_glue {
static const char kIntentsInlineDisposition[] = "inline";
WebIntentServiceData::WebIntentServiceData()
: disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
}
WebIntentServiceData::WebIntentServiceData(const GURL& svc_url,
const string16& svc_action,
const string16& svc_type,
const string16& svc_title)
: service_url(svc_url),
action(svc_action),
type(svc_type),
title(svc_title),
disposition(WebIntentServiceData::DISPOSITION_WINDOW) {
}
WebIntentServiceData::~WebIntentServiceData() {}
bool WebIntentServiceData::operator==(const WebIntentServiceData& other) const {
return service_url == other.service_url &&
action == other.action &&
type == other.type &&
title == other.title &&
disposition == other.disposition;
}
void WebIntentServiceData::setDisposition(const string16& disp) {
if (disp == ASCIIToUTF16(webkit_glue::kIntentsInlineDisposition))
disposition = DISPOSITION_INLINE;
else
disposition = DISPOSITION_WINDOW;
}
std::ostream& operator<<(::std::ostream& os,
const WebIntentServiceData& intent) {
return os <<
"{" << intent.service_url <<
", " << UTF16ToUTF8(intent.action) <<
", " << UTF16ToUTF8(intent.type) <<
", " << UTF16ToUTF8(intent.title) <<
", " << intent.disposition <<
"}";
}
} // namespace webkit_glue
|