// 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 "ppapi/shared_impl/instance_impl.h"

#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_input_event.h"

namespace ppapi {

InstanceImpl::~InstanceImpl() {
}

int32_t InstanceImpl::ValidateRequestInputEvents(bool is_filtering,
                                                 uint32_t event_classes) {
  // See if any bits are set we don't know about.
  if (event_classes &
      ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE |
                             PP_INPUTEVENT_CLASS_KEYBOARD |
                             PP_INPUTEVENT_CLASS_WHEEL |
                             PP_INPUTEVENT_CLASS_TOUCH |
                             PP_INPUTEVENT_CLASS_IME))
    return PP_ERROR_NOTSUPPORTED;

  // See if the keyboard is requested in non-filtering mode.
  if (!is_filtering && (event_classes & PP_INPUTEVENT_CLASS_KEYBOARD))
    return PP_ERROR_NOTSUPPORTED;

  // Everything else is valid.
  return PP_OK;
}

}  // namespace ppapi

// 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 "ppapi/shared_impl/instance_impl.h"

#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_input_event.h"

namespace ppapi {

InstanceImpl::~InstanceImpl() {
}

int32_t InstanceImpl::ValidateRequestInputEvents(bool is_filtering,
                                                 uint32_t event_classes) {
  // See if any bits are set we don't know about.
  if (event_classes &
      ~static_cast<uint32_t>(PP_INPUTEVENT_CLASS_MOUSE |
                             PP_INPUTEVENT_CLASS_KEYBOARD |
                             PP_INPUTEVENT_CLASS_WHEEL |
                             PP_INPUTEVENT_CLASS_TOUCH |
                             PP_INPUTEVENT_CLASS_IME))
    return PP_ERROR_NOTSUPPORTED;

  // Everything else is valid.
  return PP_OK;
}

}  // namespace ppapi

Fix return value when unfiltered keyboard events are registered.
Fix return value when unfiltered keyboard events are registered.

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/7489011

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@93662 0039d316-1c4b-4281-b951-d872f2087c98
