<commit_before>// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "xwalk/runtime/browser/ui/tizen_system_indicator.h"

#include "ui/gfx/canvas.h"
#include "content/public/browser/browser_thread.h"
#include "xwalk/runtime/browser/ui/tizen_system_indicator_watcher.h"

#include "ui/views/widget/native_widget.h"
#include "ui/views/widget/root_view.h"
#include "ui/aura/root_window.h"

namespace {

SkColor kBGColor = SkColorSetARGB(255, 52, 52, 50);

}  // namespace

namespace xwalk {

TizenSystemIndicator::TizenSystemIndicator()
    : watcher_(new TizenSystemIndicatorWatcher(this)) {
  if (!watcher_->Connect()) {
    watcher_.reset();
    return;
  }

  set_background(views::Background::CreateSolidBackground(kBGColor));

  content::BrowserThread::PostTask(
      content::BrowserThread::IO, FROM_HERE,
      base::Bind(&TizenSystemIndicatorWatcher::StartWatching,
                 base::Unretained(watcher_.get())));
}

TizenSystemIndicator::~TizenSystemIndicator() {
}

bool TizenSystemIndicator::IsConnected() const {
  return watcher_;
}

void TizenSystemIndicator::OnPaint(gfx::Canvas* canvas) {
  View::OnPaint(canvas);

  if (image_.isNull())
    return;
  canvas->DrawImageInt(image_, 0, 0);
}

gfx::Size TizenSystemIndicator::GetPreferredSize() {
  return watcher_->GetSize();
}

void TizenSystemIndicator::SetImage(const gfx::ImageSkia& img) {
  image_ = img;
  SchedulePaint();
}

bool TizenSystemIndicator::OnMousePressed(const ui::MouseEvent& event) {
  watcher_->OnMouseDown();
  return true;
}

void TizenSystemIndicator::OnMouseReleased(const ui::MouseEvent& event) {
  watcher_->OnMouseUp();
}

void TizenSystemIndicator::OnTouchEvent(ui::TouchEvent* event) {
  const gfx::Point position = event->location();

  switch (event->type()) {
    case ui::ET_UNKNOWN:
    case ui::ET_MOUSE_PRESSED:
    case ui::ET_MOUSE_DRAGGED:
    case ui::ET_MOUSE_RELEASED:
    case ui::ET_MOUSE_MOVED:
    case ui::ET_MOUSE_ENTERED:
    case ui::ET_MOUSE_EXITED:
    case ui::ET_KEY_PRESSED:
    case ui::ET_KEY_RELEASED:
    case ui::ET_MOUSEWHEEL:
    case ui::ET_MOUSE_CAPTURE_CHANGED:
    case ui::ET_TOUCH_RELEASED:
      watcher_->OnMouseUp();
      break;
    case ui::ET_TOUCH_PRESSED:
      watcher_->OnMouseDown();
      break;
    case ui::ET_TOUCH_MOVED:
      watcher_->OnMouseMove(position.x(), position.y());
      break;
    case ui::ET_TOUCH_STATIONARY:
    case ui::ET_TOUCH_CANCELLED:
    case ui::ET_DROP_TARGET_EVENT:
    case ui::ET_TRANSLATED_KEY_PRESS:
    case ui::ET_TRANSLATED_KEY_RELEASE:
    case ui::ET_GESTURE_SCROLL_BEGIN:
    case ui::ET_GESTURE_SCROLL_END:
    case ui::ET_GESTURE_SCROLL_UPDATE:
    case ui::ET_GESTURE_TAP:
    case ui::ET_GESTURE_TAP_DOWN:
    case ui::ET_GESTURE_TAP_CANCEL:
    case ui::ET_GESTURE_BEGIN:
    case ui::ET_GESTURE_END:
    case ui::ET_GESTURE_TWO_FINGER_TAP:
    case ui::ET_GESTURE_PINCH_BEGIN:
    case ui::ET_GESTURE_PINCH_END:
    case ui::ET_GESTURE_PINCH_UPDATE:
    case ui::ET_GESTURE_LONG_PRESS:
    case ui::ET_GESTURE_LONG_TAP:
    case ui::ET_GESTURE_MULTIFINGER_SWIPE:
    case ui::ET_SCROLL:
    case ui::ET_SCROLL_FLING_START:
    case ui::ET_SCROLL_FLING_CANCEL:
    case ui::ET_CANCEL_MODE:
    case ui::ET_LAST:
      break;
  }
  event->SetHandled();
}

void TizenSystemIndicator::OnMouseMoved(const ui::MouseEvent& event) {
  const gfx::Point position = event.location();
  watcher_->OnMouseMove(position.x(), position.y());
}

}  // namespace xwalk<commit_msg>Fix build introduced by tizen_system_indicator<commit_after>// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "xwalk/runtime/browser/ui/tizen_system_indicator.h"

#include "ui/gfx/canvas.h"
#include "content/public/browser/browser_thread.h"
#include "xwalk/runtime/browser/ui/tizen_system_indicator_watcher.h"

#include "ui/views/widget/native_widget.h"
#include "ui/views/widget/root_view.h"
#include "ui/aura/root_window.h"

namespace {

SkColor kBGColor = SkColorSetARGB(255, 52, 52, 50);

}  // namespace

namespace xwalk {

TizenSystemIndicator::TizenSystemIndicator()
    : watcher_(new TizenSystemIndicatorWatcher(this)) {
  if (!watcher_->Connect()) {
    watcher_.reset();
    return;
  }

  set_background(views::Background::CreateSolidBackground(kBGColor));

  content::BrowserThread::PostTask(
      content::BrowserThread::IO, FROM_HERE,
      base::Bind(&TizenSystemIndicatorWatcher::StartWatching,
                 base::Unretained(watcher_.get())));
}

TizenSystemIndicator::~TizenSystemIndicator() {
}

bool TizenSystemIndicator::IsConnected() const {
  return watcher_;
}

void TizenSystemIndicator::OnPaint(gfx::Canvas* canvas) {
  View::OnPaint(canvas);

  if (image_.isNull())
    return;
  canvas->DrawImageInt(image_, 0, 0);
}

gfx::Size TizenSystemIndicator::GetPreferredSize() {
  return watcher_->GetSize();
}

void TizenSystemIndicator::SetImage(const gfx::ImageSkia& img) {
  image_ = img;
  SchedulePaint();
}

bool TizenSystemIndicator::OnMousePressed(const ui::MouseEvent& event) {
  watcher_->OnMouseDown();
  return true;
}

void TizenSystemIndicator::OnMouseReleased(const ui::MouseEvent& event) {
  watcher_->OnMouseUp();
}

void TizenSystemIndicator::OnTouchEvent(ui::TouchEvent* event) {
  const gfx::Point position = event->location();

  switch (event->type()) {
    case ui::ET_UNKNOWN:
    case ui::ET_MOUSE_PRESSED:
    case ui::ET_MOUSE_DRAGGED:
    case ui::ET_MOUSE_RELEASED:
    case ui::ET_MOUSE_MOVED:
    case ui::ET_MOUSE_ENTERED:
    case ui::ET_MOUSE_EXITED:
    case ui::ET_KEY_PRESSED:
    case ui::ET_KEY_RELEASED:
    case ui::ET_MOUSEWHEEL:
    case ui::ET_MOUSE_CAPTURE_CHANGED:
    case ui::ET_TOUCH_RELEASED:
      watcher_->OnMouseUp();
      break;
    case ui::ET_TOUCH_PRESSED:
      watcher_->OnMouseDown();
      break;
    case ui::ET_TOUCH_MOVED:
      watcher_->OnMouseMove(position.x(), position.y());
      break;
    case ui::ET_TOUCH_STATIONARY:
    case ui::ET_TOUCH_CANCELLED:
    case ui::ET_DROP_TARGET_EVENT:
    case ui::ET_TRANSLATED_KEY_PRESS:
    case ui::ET_TRANSLATED_KEY_RELEASE:
    case ui::ET_GESTURE_SCROLL_BEGIN:
    case ui::ET_GESTURE_SCROLL_END:
    case ui::ET_GESTURE_SCROLL_UPDATE:
    case ui::ET_GESTURE_TAP:
    case ui::ET_GESTURE_TAP_DOWN:
    case ui::ET_GESTURE_TAP_CANCEL:
    case ui::ET_GESTURE_BEGIN:
    case ui::ET_GESTURE_END:
    case ui::ET_GESTURE_TWO_FINGER_TAP:
    case ui::ET_GESTURE_PINCH_BEGIN:
    case ui::ET_GESTURE_PINCH_END:
    case ui::ET_GESTURE_PINCH_UPDATE:
    case ui::ET_GESTURE_LONG_PRESS:
    case ui::ET_GESTURE_LONG_TAP:
    case ui::ET_GESTURE_MULTIFINGER_SWIPE:
    case ui::ET_SCROLL:
    case ui::ET_SCROLL_FLING_START:
    case ui::ET_SCROLL_FLING_CANCEL:
    case ui::ET_CANCEL_MODE:
    case ui::ET_UMA_DATA:
    case ui::ET_LAST:
      break;
  }
  event->SetHandled();
}

void TizenSystemIndicator::OnMouseMoved(const ui::MouseEvent& event) {
  const gfx::Point position = event.location();
  watcher_->OnMouseMove(position.x(), position.y());
}

}  // namespace xwalk
{'fraction_non_alphanumeric': 0.1220390635822136, 'fraction_numerical': 0.00415570023548968, 'mean_word_length': 4.7991967871485945, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5098035', 'n_tokens_mistral': 2697, 'n_tokens_neox': 2700, 'n_words': 429}