summaryrefslogtreecommitdiffstats
path: root/chrome/common/appcache/appcache_dispatcher.cc
blob: 6cf40cc71b416612729b2cb8a3f0b509d505d53a (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2010 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/common/appcache/appcache_dispatcher.h"

#include "chrome/common/render_messages.h"
#include "webkit/appcache/web_application_cache_host_impl.h"

bool AppCacheDispatcher::OnMessageReceived(const IPC::Message& msg) {
  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(AppCacheDispatcher, msg)
    IPC_MESSAGE_HANDLER(AppCacheMsg_CacheSelected, OnCacheSelected)
    IPC_MESSAGE_HANDLER(AppCacheMsg_StatusChanged, OnStatusChanged)
    IPC_MESSAGE_HANDLER(AppCacheMsg_EventRaised, OnEventRaised)
    IPC_MESSAGE_HANDLER(AppCacheMsg_ProgressEventRaised, OnProgressEventRaised)
    IPC_MESSAGE_HANDLER(AppCacheMsg_ErrorEventRaised, OnErrorEventRaised)
    IPC_MESSAGE_HANDLER(AppCacheMsg_LogMessage, OnLogMessage)
    IPC_MESSAGE_HANDLER(AppCacheMsg_ContentBlocked, OnContentBlocked)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()
  return handled;
}

void AppCacheDispatcher::OnCacheSelected(int host_id, int64 cache_id,
                                         appcache::Status status) {
  frontend_impl_.OnCacheSelected(host_id, cache_id, status);
}

void AppCacheDispatcher::OnStatusChanged(const std::vector<int>& host_ids,
                                         appcache::Status status) {
  frontend_impl_.OnStatusChanged(host_ids, status);
}

void AppCacheDispatcher::OnEventRaised(const std::vector<int>& host_ids,
                                       appcache::EventID event_id) {
  frontend_impl_.OnEventRaised(host_ids, event_id);
}

void AppCacheDispatcher::OnProgressEventRaised(
    const std::vector<int>& host_ids,
    const GURL& url, int num_total, int num_complete) {
  frontend_impl_.OnProgressEventRaised(host_ids, url, num_total, num_complete);
}

void AppCacheDispatcher::OnErrorEventRaised(
    const std::vector<int>& host_ids,
    const std::string& message) {
  frontend_impl_.OnErrorEventRaised(host_ids, message);
}

void AppCacheDispatcher::OnLogMessage(
    int host_id, int log_level, const std::string& message) {
  frontend_impl_.OnLogMessage(
      host_id, static_cast<appcache::LogLevel>(log_level), message);
}

void AppCacheDispatcher::OnContentBlocked(int host_id,
                                          const GURL& manifest_url) {
  frontend_impl_.OnContentBlocked(host_id, manifest_url);
}