<commit_before>// 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/notifications/notification.h"

#include "chrome/browser/notifications/desktop_notification_service.h"

Notification::Notification(const GURL& origin_url,
                           const GURL& content_url,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
 : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
    origin_url_(origin_url),
    is_html_(true),
    content_url_(content_url),
    display_source_(display_source),
    replace_id_(replace_id),
    delegate_(delegate) {
}

Notification::Notification(const GURL& origin_url,
                           const GURL& icon_url,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
    : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
      origin_url_(origin_url),
      icon_url_(icon_url),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),
      delegate_(delegate) {
  // "Upconvert" the string parameters to a data: URL.
  content_url_ = GURL(DesktopNotificationService::CreateDataUrl(
      icon_url, title, body, dir));
}

Notification::Notification(ui::notifications::NotificationType type,
                           const GURL& origin_url,
                           const GURL& icon_url,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           const DictionaryValue* optional_fields,
                           NotificationDelegate* delegate)
    : type_(type),
      origin_url_(origin_url),
      icon_url_(icon_url),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),
      optional_fields_(NULL),
      delegate_(delegate) {
  if (optional_fields)
    optional_fields_.reset(optional_fields->DeepCopy());
}

Notification::Notification(const GURL& origin_url,
                           const gfx::ImageSkia& icon,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
    : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
      origin_url_(origin_url),
      icon_(icon),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),<commit_msg>Allow new Notification API to fill old balloon style.<commit_after>// 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/notifications/notification.h"

#include "chrome/browser/notifications/desktop_notification_service.h"

Notification::Notification(const GURL& origin_url,
                           const GURL& content_url,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
 : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
    origin_url_(origin_url),
    is_html_(true),
    content_url_(content_url),
    display_source_(display_source),
    replace_id_(replace_id),
    delegate_(delegate) {
}

Notification::Notification(const GURL& origin_url,
                           const GURL& icon_url,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
    : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
      origin_url_(origin_url),
      icon_url_(icon_url),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),
      delegate_(delegate) {
  // "Upconvert" the string parameters to a data: URL.
  content_url_ = GURL(DesktopNotificationService::CreateDataUrl(
      icon_url, title, body, dir));
}

Notification::Notification(ui::notifications::NotificationType type,
                           const GURL& origin_url,
                           const GURL& icon_url,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           const DictionaryValue* optional_fields,
                           NotificationDelegate* delegate)
    : type_(type),
      origin_url_(origin_url),
      icon_url_(icon_url),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),
      optional_fields_(NULL),
      delegate_(delegate) {
  if (optional_fields)
    optional_fields_.reset(optional_fields->DeepCopy());
  // "Upconvert" the string parameters to a data: URL.  Some balloon views
  // require content URL to render anything, so this serves as a backup.
  content_url_ = GURL(DesktopNotificationService::CreateDataUrl(
      icon_url, title, body, dir));
}

Notification::Notification(const GURL& origin_url,
                           const gfx::ImageSkia& icon,
                           const string16& title,
                           const string16& body,
                           WebKit::WebTextDirection dir,
                           const string16& display_source,
                           const string16& replace_id,
                           NotificationDelegate* delegate)
    : type_(ui::notifications::NOTIFICATION_TYPE_SIMPLE),
      origin_url_(origin_url),
      icon_(icon),
      is_html_(false),
      title_(title),
      body_(body),
      display_source_(display_source),
      replace_id_(replace_id),
{'fraction_non_alphanumeric': 0.07868279178201952, 'fraction_numerical': 0.009325367914906018, 'mean_word_length': 1.9396145610278372, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3860344', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1691, 'n_words': 374}