summaryrefslogtreecommitdiffstats
path: root/content/child/geofencing/geofencing_message_filter.cc
blob: a866b378f395bf35992b4b2bd8b9903a63468f2e (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
// Copyright 2014 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 "content/child/geofencing/geofencing_message_filter.h"

#include "content/child/geofencing/geofencing_dispatcher.h"
#include "ipc/ipc_message_macros.h"

namespace content {

GeofencingMessageFilter::GeofencingMessageFilter(ThreadSafeSender* sender)
    : WorkerThreadMessageFilter(sender) {
}

GeofencingMessageFilter::~GeofencingMessageFilter() {
}

bool GeofencingMessageFilter::ShouldHandleMessage(
    const IPC::Message& msg) const {
  return IPC_MESSAGE_CLASS(msg) == GeofencingMsgStart;
}

void GeofencingMessageFilter::OnFilteredMessageReceived(
    const IPC::Message& msg) {
  GeofencingDispatcher::GetOrCreateThreadSpecificInstance(thread_safe_sender())
      ->OnMessageReceived(msg);
}

bool GeofencingMessageFilter::GetWorkerThreadIdForMessage(
    const IPC::Message& msg,
    int* ipc_thread_id) {
  return PickleIterator(msg).ReadInt(ipc_thread_id);
}

}  // namespace content