summaryrefslogtreecommitdiffstats
path: root/chrome/browser/intents/default_web_intent_service.cc
blob: 9f369edda53b8d85d94679fc37c2a0948abf29fc (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
// Copyright (c) 2012 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/browser/intents/default_web_intent_service.h"
#include "base/string_util.h"

DefaultWebIntentService::DefaultWebIntentService()
  : url_pattern(URLPattern::SCHEME_ALL, URLPattern::kAllUrlsPattern),
    user_date(-1),
    suppression(0) {}

DefaultWebIntentService::DefaultWebIntentService(
    const string16& srv_action,
    const string16& srv_type,
    const std::string& srv_service_url)
    : action(srv_action), type(srv_type),
      url_pattern(URLPattern::SCHEME_ALL, URLPattern::kAllUrlsPattern),
      user_date(-1), suppression(0), service_url(srv_service_url) {}

DefaultWebIntentService::DefaultWebIntentService(
    const string16& srv_scheme,
    const std::string& srv_service_url)
    : scheme(srv_scheme),
      url_pattern(URLPattern::SCHEME_ALL, URLPattern::kAllUrlsPattern),
      user_date(-1), suppression(0), service_url(srv_service_url) {}

DefaultWebIntentService::~DefaultWebIntentService() {}

std::string DefaultWebIntentService::ToString() const {
  return "{action=" + UTF16ToASCII(action)
      + ", type=" + UTF16ToASCII(type)
      + ", service_url=" + service_url
      + ", url_pattern=" + url_pattern.GetAsString()
      + "}";
}

bool DefaultWebIntentService::operator==(
    const DefaultWebIntentService& other) const {
  return action == other.action &&
         type == other.type &&
         scheme == other.scheme &&
         url_pattern == other.url_pattern &&
         user_date == other.user_date &&
         suppression == other.suppression &&
         service_url == other.service_url;
}